Class DefaultRuleCompilationContext
- java.lang.Object
-
- de.hybris.platform.ruleengineservices.maintenance.impl.DefaultRuleCompilationContext
-
- All Implemented Interfaces:
TaskContext,RuleCompilationContext
public class DefaultRuleCompilationContext extends java.lang.Object implements RuleCompilationContext
Default implementation of theRuleCompilationContextinterface
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringWORKER_PRE_DESTROY_TIMEOUT
-
Constructor Summary
Constructors Constructor Description DefaultRuleCompilationContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup(java.lang.String moduleName)Clean up the context (usually called before the object destroy)protected ConcurrentMapFactorygetConcurrentMapFactory()protected ConfigurationServicegetConfigurationService()TenantgetCurrentTenant()Get the currently active tenantprotected EventServicegetEventService()java.lang.LonggetNextRuleEngineRuleVersion(java.lang.String moduleName)get the next available rule version for the moduleintgetNumberOfThreads()get the maximum number of threads to allocate for multi-thread executionRuleCompilerServicegetRuleCompilerService()get the instance ofRuleCompilerServiceprotected RuleEngineSpliteratorStrategygetRuleEngineSpliteratorStrategy()protected RulesModuleDaogetRulesModuleDao()SuspendResumeTaskManagergetSuspendResumeTaskManager()get the suspend/resume task managerjava.util.concurrent.ThreadFactorygetThreadFactory()get the thread factory to be used for creating the tenant-aware threadsjava.lang.LonggetThreadTimeout()get the thread pre-destroy timeoutvoidregisterCompilationListeners(java.lang.String moduleName)register aplication listeners related to rule compilation processjava.util.concurrent.atomic.AtomicLongresetRuleEngineRuleVersion(java.lang.String moduleName)Resets the compilation context version to the value associated with rules modulevoidsetConcurrentMapFactory(ConcurrentMapFactory concurrentMapFactory)voidsetConfigurationService(ConfigurationService configurationService)voidsetCurrentTenant(Tenant currentTenant)voidsetEventService(EventService eventService)voidsetRuleCompilerService(RuleCompilerService ruleCompilerService)voidsetRuleEngineSpliteratorStrategy(RuleEngineSpliteratorStrategy ruleEngineSpliteratorStrategy)voidsetRulesModuleDao(RulesModuleDao rulesModuleDao)voidsetSuspendResumeTaskManager(SuspendResumeTaskManager suspendResumeTaskManager)voidsetThreadFactory(java.util.concurrent.ThreadFactory threadFactory)voidsetUp()
-
-
-
Field Detail
-
WORKER_PRE_DESTROY_TIMEOUT
public static final java.lang.String WORKER_PRE_DESTROY_TIMEOUT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCurrentTenant
public Tenant getCurrentTenant()
Description copied from interface:TaskContextGet the currently active tenant- Specified by:
getCurrentTenantin interfaceTaskContext- Returns:
- The active tenant
-
getThreadFactory
public java.util.concurrent.ThreadFactory getThreadFactory()
Description copied from interface:TaskContextget the thread factory to be used for creating the tenant-aware threads- Specified by:
getThreadFactoryin interfaceTaskContext- Returns:
- the thread factory implementation
-
getRuleCompilerService
public RuleCompilerService getRuleCompilerService()
Description copied from interface:RuleCompilationContextget the instance ofRuleCompilerService- Specified by:
getRuleCompilerServicein interfaceRuleCompilationContext- Returns:
- instance of
RuleCompilerService
-
getNumberOfThreads
public int getNumberOfThreads()
Description copied from interface:TaskContextget the maximum number of threads to allocate for multi-thread execution- Specified by:
getNumberOfThreadsin interfaceTaskContext- Returns:
- number of threads
-
getThreadTimeout
public java.lang.Long getThreadTimeout()
Description copied from interface:TaskContextget the thread pre-destroy timeout- Specified by:
getThreadTimeoutin interfaceTaskContext- Returns:
- number of milliseconds to wait before forcing the thread to join
-
resetRuleEngineRuleVersion
public java.util.concurrent.atomic.AtomicLong resetRuleEngineRuleVersion(java.lang.String moduleName)
Description copied from interface:RuleCompilationContextResets the compilation context version to the value associated with rules module- Specified by:
resetRuleEngineRuleVersionin interfaceRuleCompilationContext- Parameters:
moduleName- the module name for the series of rules to compile- Returns:
- the instance of
AtomicLongkeeping the module rules version
-
getNextRuleEngineRuleVersion
public java.lang.Long getNextRuleEngineRuleVersion(java.lang.String moduleName)
Description copied from interface:RuleCompilationContextget the next available rule version for the module- Specified by:
getNextRuleEngineRuleVersionin interfaceRuleCompilationContext- Parameters:
moduleName- the module name for the series of rules to compile- Returns:
- a version number
-
cleanup
public void cleanup(java.lang.String moduleName)
Description copied from interface:RuleCompilationContextClean up the context (usually called before the object destroy)- Specified by:
cleanupin interfaceRuleCompilationContext- Parameters:
moduleName- the rules module name to be monitored by listeners
-
registerCompilationListeners
public void registerCompilationListeners(java.lang.String moduleName)
Description copied from interface:RuleCompilationContextregister aplication listeners related to rule compilation process- Specified by:
registerCompilationListenersin interfaceRuleCompilationContext- Parameters:
moduleName- the rules module name to be monitored by listeners
-
setUp
@PostConstruct public void setUp()
-
setCurrentTenant
public void setCurrentTenant(Tenant currentTenant)
-
setThreadFactory
public void setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
-
setRuleCompilerService
public void setRuleCompilerService(RuleCompilerService ruleCompilerService)
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getConfigurationService
protected ConfigurationService getConfigurationService()
-
getRuleEngineSpliteratorStrategy
protected RuleEngineSpliteratorStrategy getRuleEngineSpliteratorStrategy()
-
setRuleEngineSpliteratorStrategy
public void setRuleEngineSpliteratorStrategy(RuleEngineSpliteratorStrategy ruleEngineSpliteratorStrategy)
-
getRulesModuleDao
protected RulesModuleDao getRulesModuleDao()
-
setRulesModuleDao
public void setRulesModuleDao(RulesModuleDao rulesModuleDao)
-
getEventService
protected EventService getEventService()
-
setEventService
public void setEventService(EventService eventService)
-
getConcurrentMapFactory
protected ConcurrentMapFactory getConcurrentMapFactory()
-
setConcurrentMapFactory
public void setConcurrentMapFactory(ConcurrentMapFactory concurrentMapFactory)
-
getSuspendResumeTaskManager
public SuspendResumeTaskManager getSuspendResumeTaskManager()
Description copied from interface:RuleCompilationContextget the suspend/resume task manager- Specified by:
getSuspendResumeTaskManagerin interfaceRuleCompilationContext- Returns:
- instance of
SuspendResumeTaskManager
-
setSuspendResumeTaskManager
public void setSuspendResumeTaskManager(SuspendResumeTaskManager suspendResumeTaskManager)
-
-