jBPM distribution 6.2.0.CR2

org.jbpm.runtime.manager.impl
Class PerProcessInstanceRuntimeManager

java.lang.Object
  extended by org.jbpm.runtime.manager.impl.AbstractRuntimeManager
      extended by org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager
All Implemented Interfaces:
RuntimeManager, org.kie.internal.runtime.manager.InternalRuntimeManager

public class PerProcessInstanceRuntimeManager
extends AbstractRuntimeManager

A RuntimeManager implementation that is backed by the "Per Process Instance" strategy. This means that every process instance will be bound to a ksession for it's entire life time. Once started, whenever other operations are invoked, this manager will ensure that the correct ksession will be provided.
This also applies to sub processes (reusable sub processes) that create new process instances: the sub process instance will have its own ksession independent of the parent one.
This manager will ensure that as soon as the process instance completes, the ksession will be disposed of and destroyed.
This implementation supports the following Context implementations:


Field Summary
 
Fields inherited from class org.jbpm.runtime.manager.impl.AbstractRuntimeManager
cacheManager, closed, deploymentDescriptor, engineInitEager, environment, identifier, registry, securityManager
 
Constructor Summary
PerProcessInstanceRuntimeManager(RuntimeEnvironment environment, org.kie.internal.runtime.manager.SessionFactory factory, org.kie.internal.runtime.manager.TaskServiceFactory taskServiceFactory, String identifier)
           
 
Method Summary
 void close()
          Closes RuntimeManager and releases it's resources.
 void disposeRuntimeEngine(RuntimeEngine runtime)
          Disposes RuntimeEngine and notifies all listeners about that fact.
protected  RuntimeEngine findLocalRuntime(Object processInstanceId)
           
 org.kie.internal.runtime.manager.SessionFactory getFactory()
           
 org.kie.internal.runtime.manager.Mapper getMapper()
           
 RuntimeEngine getRuntimeEngine(Context<?> context)
          Returns RuntimeEngine instance that is fully initialized: KiseSession is created or loaded depending on the strategy TaskService is initialized and attached to ksession (via listener) WorkItemHandlers are initialized and registered on ksession EventListeners (process, agenda, working memory) are initialized and added to ksession
 org.kie.internal.runtime.manager.TaskServiceFactory getTaskServiceFactory()
           
 void init()
           
protected  void removeLocalRuntime(RuntimeEngine runtime)
           
protected  void saveLocalRuntime(Object processInstanceId, RuntimeEngine runtime)
           
 void setFactory(org.kie.internal.runtime.manager.SessionFactory factory)
           
 void setMapper(org.kie.internal.runtime.manager.Mapper mapper)
           
 void setTaskServiceFactory(org.kie.internal.runtime.manager.TaskServiceFactory taskServiceFactory)
           
 boolean validate(Integer ksessionId, Long processInstanceId)
           
 void validate(KieSession ksession, Context<?> context)
           
 
Methods inherited from class org.jbpm.runtime.manager.impl.AbstractRuntimeManager
attachManager, canDestroy, checkPermission, close, configureRuntimeOnTaskService, getCacheManager, getDeploymentDescriptor, getEnvironment, getIdentifier, getTransactionManager, hasEnvironmentEntry, isClosed, registerDisposeCallback, registerItems, removeRuntimeFromTaskService, setCacheManager, setDeploymentDescriptor, setEnvironment, setIdentifier, setSecurityManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerProcessInstanceRuntimeManager

public PerProcessInstanceRuntimeManager(RuntimeEnvironment environment,
                                        org.kie.internal.runtime.manager.SessionFactory factory,
                                        org.kie.internal.runtime.manager.TaskServiceFactory taskServiceFactory,
                                        String identifier)
Method Detail

getRuntimeEngine

public RuntimeEngine getRuntimeEngine(Context<?> context)
Description copied from interface: RuntimeManager
Returns RuntimeEngine instance that is fully initialized:

Parameters:
context - the concrete implementation of the context that is supported by given RuntimeManager
Returns:
instance of the RuntimeEngine

validate

public void validate(KieSession ksession,
                     Context<?> context)
              throws IllegalStateException
Throws:
IllegalStateException

disposeRuntimeEngine

public void disposeRuntimeEngine(RuntimeEngine runtime)
Description copied from interface: RuntimeManager
Disposes RuntimeEngine and notifies all listeners about that fact. This method should always be used to dispose RuntimeEngine that is not needed anymore.
ksession.dispose() shall never be used with RuntimeManager as it will break the internal mechanisms of the manager responsible for clear and efficient disposal.
Dispose is not needed if RuntimeEngine was obtained within active JTA transaction, this means that when getRuntimeEngine method was invoked during active JTA transaction then dispose of the runtime engine will happen automatically on transaction completion.


close

public void close()
Description copied from interface: RuntimeManager
Closes RuntimeManager and releases it's resources. Shall always be called when runtime manager is not needed any more. Otherwise it will still be active and operational.

Specified by:
close in interface RuntimeManager
Overrides:
close in class AbstractRuntimeManager

validate

public boolean validate(Integer ksessionId,
                        Long processInstanceId)

getFactory

public org.kie.internal.runtime.manager.SessionFactory getFactory()

setFactory

public void setFactory(org.kie.internal.runtime.manager.SessionFactory factory)

getTaskServiceFactory

public org.kie.internal.runtime.manager.TaskServiceFactory getTaskServiceFactory()

setTaskServiceFactory

public void setTaskServiceFactory(org.kie.internal.runtime.manager.TaskServiceFactory taskServiceFactory)

getMapper

public org.kie.internal.runtime.manager.Mapper getMapper()

setMapper

public void setMapper(org.kie.internal.runtime.manager.Mapper mapper)

findLocalRuntime

protected RuntimeEngine findLocalRuntime(Object processInstanceId)

saveLocalRuntime

protected void saveLocalRuntime(Object processInstanceId,
                                RuntimeEngine runtime)

removeLocalRuntime

protected void removeLocalRuntime(RuntimeEngine runtime)

init

public void init()
Specified by:
init in class AbstractRuntimeManager

jBPM distribution 6.2.0.CR2

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.