Package org.jbpm.runtime.manager.impl
Class AbstractRuntimeManager
- java.lang.Object
-
- org.jbpm.runtime.manager.impl.AbstractRuntimeManager
-
- All Implemented Interfaces:
org.kie.api.runtime.manager.RuntimeManager,org.kie.internal.runtime.manager.InternalRuntimeManager
- Direct Known Subclasses:
PerCaseRuntimeManager,PerProcessInstanceRuntimeManager,PerRequestRuntimeManager,SingletonRuntimeManager
public abstract class AbstractRuntimeManager extends Object implements org.kie.internal.runtime.manager.InternalRuntimeManager
Common implementation that allRuntimeManagerimplementations should inherit from. Provides the following capabilities:- keeps track of all active managers by their identifier and prevents multiple managers from having the same id
- provides a common close operation
- injects the RuntimeManager into the ksession's environment for further reference
- registers dispose callbacks (via transaction synchronization) to dispose of the runtime engine automatically on transaction completion
- registers all defined items (work item handlers, event listeners)
initmethod that will be called on RuntimeManager instantiation.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.kie.internal.runtime.manager.CacheManagercacheManagerprotected booleanclosedprotected org.kie.internal.runtime.conf.DeploymentDescriptordeploymentDescriptorprotected booleanengineInitEagerprotected org.kie.api.runtime.manager.RuntimeEnvironmentenvironmentprotected org.kie.internal.runtime.error.ExecutionErrorManagerexecutionErrorManagerprotected Stringidentifierprotected org.kie.api.runtime.KieContainerkieContainerprotected RuntimeManagerLockStrategyFactorylockStrategyFactoryprotected org.kie.internal.runtime.manager.RuntimeManagerRegistryregistryprotected RuntimeManagerLockStrategyruntimeManagerLockStrategyprotected org.kie.internal.runtime.manager.SecurityManagersecurityManagerprotected RuntimeManagerLockWatcherSingletonServicewatcher
-
Constructor Summary
Constructors Constructor Description AbstractRuntimeManager(org.kie.api.runtime.manager.RuntimeEnvironment environment, String identifier)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactivate()protected voidattachManager(org.kie.api.runtime.manager.RuntimeEngine runtime)protected booleancanDestroy(org.kie.api.runtime.manager.RuntimeEngine runtime)protected booleancanDispose(org.kie.api.runtime.manager.RuntimeEngine runtime)protected voidcheckPermission()voidclose()voidclose(boolean removeJobs)protected voidconfigureRuntimeOnTaskService(org.kie.internal.task.api.InternalTaskService internalTaskService, org.kie.api.runtime.manager.RuntimeEngine engine)protected voidcreateLockOnGetEngine(Long id, org.kie.api.runtime.manager.RuntimeEngine runtime)protected voidcreateLockOnGetEngine(org.kie.api.runtime.manager.Context<?> context, org.kie.api.runtime.manager.RuntimeEngine runtime)protected voidcreateLockOnNewProcessInstance(Long id, org.kie.api.runtime.manager.RuntimeEngine runtime)voiddeactivate()org.kie.internal.runtime.manager.CacheManagergetCacheManager()org.kie.internal.runtime.conf.DeploymentDescriptorgetDeploymentDescriptor()org.kie.internal.runtime.manager.RuntimeEnvironmentgetEnvironment()org.kie.internal.runtime.error.ExecutionErrorManagergetExecutionErrorManager()abstract org.kie.internal.runtime.manager.SessionFactorygetFactory()StringgetIdentifier()org.kie.api.runtime.KieContainergetKieContainer()protected org.drools.persistence.api.TransactionManagergetTransactionManager(org.kie.api.runtime.Environment env)protected org.drools.persistence.api.TransactionManagergetTransactionManagerInternal(org.kie.api.runtime.Environment env)protected booleanhasEnvironmentEntry(String name, Object value)booleanhasSecurityManager()voidinit()protected voidinitTimerService()protected booleanisActive()booleanisClosed()protected booleanisUseLocking()protected org.kie.internal.task.api.InternalTaskServicenewTaskService(org.kie.internal.runtime.manager.TaskServiceFactory factory)protected voidregisterDisposeCallback(org.kie.api.runtime.manager.RuntimeEngine runtime, org.drools.persistence.api.TransactionSynchronization sync, org.kie.api.runtime.Environment environment)protected voidregisterItems(org.kie.api.runtime.manager.RuntimeEngine runtime)protected voidreleaseAndCleanLock(Long id, org.kie.api.runtime.manager.RuntimeEngine runtime)protected voidreleaseAndCleanLock(org.kie.api.runtime.manager.RuntimeEngine runtime)protected voidremoveRuntimeFromTaskService()protected voidscheduleDeadlines()voidsetCacheManager(org.kie.internal.runtime.manager.CacheManager cacheManager)voidsetDeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor deploymentDescriptor)voidsetEnvironment(org.kie.api.runtime.manager.RuntimeEnvironment environment)voidsetIdentifier(String identifier)voidsetKieContainer(org.kie.api.runtime.KieContainer kieContainer)voidsetSecurityManager(org.kie.internal.runtime.manager.SecurityManager securityManager)voidsoftDispose(org.kie.api.runtime.manager.RuntimeEngine runtimeEngine)Soft dispose means it will be invoked as sort of preparation step before actual dispose.
-
-
-
Field Detail
-
registry
protected org.kie.internal.runtime.manager.RuntimeManagerRegistry registry
-
lockStrategyFactory
protected RuntimeManagerLockStrategyFactory lockStrategyFactory
-
environment
protected org.kie.api.runtime.manager.RuntimeEnvironment environment
-
deploymentDescriptor
protected org.kie.internal.runtime.conf.DeploymentDescriptor deploymentDescriptor
-
kieContainer
protected org.kie.api.runtime.KieContainer kieContainer
-
cacheManager
protected org.kie.internal.runtime.manager.CacheManager cacheManager
-
engineInitEager
protected boolean engineInitEager
-
identifier
protected String identifier
-
closed
protected boolean closed
-
securityManager
protected org.kie.internal.runtime.manager.SecurityManager securityManager
-
executionErrorManager
protected org.kie.internal.runtime.error.ExecutionErrorManager executionErrorManager
-
runtimeManagerLockStrategy
protected RuntimeManagerLockStrategy runtimeManagerLockStrategy
-
watcher
protected RuntimeManagerLockWatcherSingletonService watcher
-
-
Constructor Detail
-
AbstractRuntimeManager
public AbstractRuntimeManager(org.kie.api.runtime.manager.RuntimeEnvironment environment, String identifier)
-
-
Method Detail
-
init
public void init()
-
initTimerService
protected void initTimerService()
-
scheduleDeadlines
protected void scheduleDeadlines()
-
registerItems
protected void registerItems(org.kie.api.runtime.manager.RuntimeEngine runtime)
-
registerDisposeCallback
protected void registerDisposeCallback(org.kie.api.runtime.manager.RuntimeEngine runtime, org.drools.persistence.api.TransactionSynchronization sync, org.kie.api.runtime.Environment environment)
-
canDispose
protected boolean canDispose(org.kie.api.runtime.manager.RuntimeEngine runtime)
-
attachManager
protected void attachManager(org.kie.api.runtime.manager.RuntimeEngine runtime)
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
close
public void close()
- Specified by:
closein interfaceorg.kie.api.runtime.manager.RuntimeManager
-
close
public void close(boolean removeJobs)
-
getEnvironment
public org.kie.internal.runtime.manager.RuntimeEnvironment getEnvironment()
- Specified by:
getEnvironmentin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
setEnvironment
public void setEnvironment(org.kie.api.runtime.manager.RuntimeEnvironment environment)
-
getIdentifier
public String getIdentifier()
- Specified by:
getIdentifierin interfaceorg.kie.api.runtime.manager.RuntimeManager
-
setIdentifier
public void setIdentifier(String identifier)
-
newTaskService
protected org.kie.internal.task.api.InternalTaskService newTaskService(org.kie.internal.runtime.manager.TaskServiceFactory factory)
-
configureRuntimeOnTaskService
protected void configureRuntimeOnTaskService(org.kie.internal.task.api.InternalTaskService internalTaskService, org.kie.api.runtime.manager.RuntimeEngine engine)
-
removeRuntimeFromTaskService
protected void removeRuntimeFromTaskService()
-
softDispose
public void softDispose(org.kie.api.runtime.manager.RuntimeEngine runtimeEngine)
Soft dispose means it will be invoked as sort of preparation step before actual dispose. Mainly used with transaction synchronization to be invoked as part of beforeCompletion to clean up any thread state - like thread local settings as afterCompletion can be invoked from another thread
-
canDestroy
protected boolean canDestroy(org.kie.api.runtime.manager.RuntimeEngine runtime)
-
getTransactionManager
protected org.drools.persistence.api.TransactionManager getTransactionManager(org.kie.api.runtime.Environment env)
-
getTransactionManagerInternal
protected org.drools.persistence.api.TransactionManager getTransactionManagerInternal(org.kie.api.runtime.Environment env)
-
getDeploymentDescriptor
public org.kie.internal.runtime.conf.DeploymentDescriptor getDeploymentDescriptor()
- Specified by:
getDeploymentDescriptorin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
setDeploymentDescriptor
public void setDeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor deploymentDescriptor)
- Specified by:
setDeploymentDescriptorin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
setSecurityManager
public void setSecurityManager(org.kie.internal.runtime.manager.SecurityManager securityManager)
- Specified by:
setSecurityManagerin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
hasSecurityManager
public boolean hasSecurityManager()
- Specified by:
hasSecurityManagerin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
checkPermission
protected void checkPermission()
-
setCacheManager
public void setCacheManager(org.kie.internal.runtime.manager.CacheManager cacheManager)
- Specified by:
setCacheManagerin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
getCacheManager
public org.kie.internal.runtime.manager.CacheManager getCacheManager()
- Specified by:
getCacheManagerin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
getKieContainer
public org.kie.api.runtime.KieContainer getKieContainer()
- Specified by:
getKieContainerin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
setKieContainer
public void setKieContainer(org.kie.api.runtime.KieContainer kieContainer)
- Specified by:
setKieContainerin interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
isUseLocking
protected boolean isUseLocking()
-
createLockOnNewProcessInstance
protected void createLockOnNewProcessInstance(Long id, org.kie.api.runtime.manager.RuntimeEngine runtime)
-
createLockOnGetEngine
protected void createLockOnGetEngine(org.kie.api.runtime.manager.Context<?> context, org.kie.api.runtime.manager.RuntimeEngine runtime)
-
createLockOnGetEngine
protected void createLockOnGetEngine(Long id, org.kie.api.runtime.manager.RuntimeEngine runtime)
-
releaseAndCleanLock
protected void releaseAndCleanLock(org.kie.api.runtime.manager.RuntimeEngine runtime)
-
releaseAndCleanLock
protected void releaseAndCleanLock(Long id, org.kie.api.runtime.manager.RuntimeEngine runtime)
-
isActive
protected boolean isActive()
-
activate
public void activate()
- Specified by:
activatein interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
deactivate
public void deactivate()
- Specified by:
deactivatein interfaceorg.kie.internal.runtime.manager.InternalRuntimeManager
-
getExecutionErrorManager
public org.kie.internal.runtime.error.ExecutionErrorManager getExecutionErrorManager()
-
getFactory
public abstract org.kie.internal.runtime.manager.SessionFactory getFactory()
-
-