Class DefaultRuleEngineTaskProcessor<I extends ItemModel>
- java.lang.Object
-
- de.hybris.platform.ruleengine.concurrency.impl.DefaultRuleEngineTaskProcessor<I>
-
- Type Parameters:
I- type ofItemModelin the list
- All Implemented Interfaces:
RuleEngineSpliteratorStrategy,RuleEngineTaskProcessor<I,TaskResult>
public class DefaultRuleEngineTaskProcessor<I extends ItemModel> extends java.lang.Object implements RuleEngineTaskProcessor<I,TaskResult>, RuleEngineSpliteratorStrategy
Default implementation ofRuleEngineTaskProcessor
-
-
Constructor Summary
Constructors Constructor Description DefaultRuleEngineTaskProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ThreadcreateAndStartNewWorker(java.util.List<I> items, java.util.function.Consumer<java.util.List<I>> taskConsumer)TaskExecutionFuture<TaskResult>execute(java.util.List<I> items, java.util.function.Consumer<java.util.List<I>> taskConsumer)Process the items in the list in multi-thread mode with provided items consumerTaskExecutionFuture<TaskResult>execute(java.util.List<I> items, java.util.function.Consumer<java.util.List<I>> taskConsumer, long predestroyTimeout)Process the items in the list in multi-thread mode with provided items consumerintgetNumberOfThreads()get the number of threads to be allocated for spliteratorprotected SuspendResumeTaskManagergetSuspendResumeTaskManager()protected TenantgetTenant()protected java.util.concurrent.ThreadFactorygetTenantAwareThreadFactory()voidsetSuspendResumeTaskManager(SuspendResumeTaskManager suspendResumeTaskManager)voidsetTenant(Tenant tenant)voidsetTenantAwareThreadFactory(java.util.concurrent.ThreadFactory tenantAwareThreadFactory)
-
-
-
Method Detail
-
execute
public TaskExecutionFuture<TaskResult> execute(java.util.List<I> items, java.util.function.Consumer<java.util.List<I>> taskConsumer)
Description copied from interface:RuleEngineTaskProcessorProcess the items in the list in multi-thread mode with provided items consumer- Specified by:
executein interfaceRuleEngineTaskProcessor<I extends ItemModel,TaskResult>- Parameters:
items- the list of items to processtaskConsumer- instance ofConsumerencapsulating the processing logic- Returns:
- The
TaskExecutionFutureof the execution process
-
execute
public TaskExecutionFuture<TaskResult> execute(java.util.List<I> items, java.util.function.Consumer<java.util.List<I>> taskConsumer, long predestroyTimeout)
Description copied from interface:RuleEngineTaskProcessorProcess the items in the list in multi-thread mode with provided items consumer- Specified by:
executein interfaceRuleEngineTaskProcessor<I extends ItemModel,TaskResult>- Parameters:
items- the list of items to processtaskConsumer- instance ofConsumerencapsulating the processing logicpredestroyTimeout- time in milliseconds to wait until forcing the thread join (to prevent eventual thread blocking)- Returns:
- The
TaskExecutionFutureof the execution process
-
getNumberOfThreads
public int getNumberOfThreads()
Description copied from interface:RuleEngineSpliteratorStrategyget the number of threads to be allocated for spliterator- Specified by:
getNumberOfThreadsin interfaceRuleEngineSpliteratorStrategy- Returns:
- number of threads to allocate
-
createAndStartNewWorker
protected java.lang.Thread createAndStartNewWorker(java.util.List<I> items, java.util.function.Consumer<java.util.List<I>> taskConsumer)
-
getTenant
protected Tenant getTenant()
-
setTenant
public void setTenant(Tenant tenant)
-
getTenantAwareThreadFactory
protected java.util.concurrent.ThreadFactory getTenantAwareThreadFactory()
-
setTenantAwareThreadFactory
public void setTenantAwareThreadFactory(java.util.concurrent.ThreadFactory tenantAwareThreadFactory)
-
getSuspendResumeTaskManager
protected SuspendResumeTaskManager getSuspendResumeTaskManager()
-
setSuspendResumeTaskManager
public void setSuspendResumeTaskManager(SuspendResumeTaskManager suspendResumeTaskManager)
-
-