org.jbpm.runtime.manager.impl

## Class PerProcessInstanceRuntimeManager

- java.lang.Object
- - org.jbpm.runtime.manager.impl.AbstractRuntimeManager
  - - org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager

- All Implemented Interfaces:
    org.kie.api.runtime.manager.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:
  - ProcessInstanceIdContext
  - CorrelationKeyContext
  - EmptyContext - for initial RuntimeEngine to start process only

- - ### Field Summary

    - ### Fields inherited from class org.jbpm.runtime.manager.impl.AbstractRuntimeManager

      `cacheManager, closed, deploymentDescriptor, engineInitEager, environment, executionErrorManager, identifier, kieContainer, lockStrategyFactory, registry, runtimeManagerLockStrategy, securityManager`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PerProcessInstanceRuntimeManager(org.kie.api.runtime.manager.RuntimeEnvironment environment, org.kie.internal.runtime.manager.SessionFactory factory, org.kie.internal.runtime.manager.TaskServiceFactory taskServiceFactory, String identifier)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activate()`
    `void` | `close()`
    `void` | `deactivate()`
    `void` | `disposeRuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine runtime)`
    `protected org.kie.api.runtime.manager.RuntimeEngine` | `findLocalRuntime(Object processInstanceId)`
    `org.kie.internal.runtime.manager.SessionFactory` | `getFactory()`
    `org.kie.internal.runtime.manager.Mapper` | `getMapper()`
    `org.kie.api.runtime.manager.RuntimeEngine` | `getRuntimeEngine(org.kie.api.runtime.manager.Context<?> context)`
    `org.kie.internal.runtime.manager.TaskServiceFactory` | `getTaskServiceFactory()`
    `void` | `init()`
    `protected boolean` | `isUseLocking()`
    `protected void` | `removeLocalRuntime(org.kie.api.runtime.manager.RuntimeEngine runtime)`
    `protected void` | `saveLocalRuntime(Object processInstanceId, org.kie.api.runtime.manager.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)`
    `void` | `signalEvent(String type, Object event)`
    `void` | `softDispose(org.kie.api.runtime.manager.RuntimeEngine runtimeEngine)` Soft dispose means it will be invoked as sort of preparation step before actual dispose.
    `void` | `validate(org.kie.api.runtime.KieSession ksession, org.kie.api.runtime.manager.Context<?> context)`
    `boolean` | `validate(Long ksessionId, Long processInstanceId)`

    - ### Methods inherited from class org.jbpm.runtime.manager.impl.AbstractRuntimeManager

      `attachManager, canDestroy, canDispose, checkPermission, close, configureRuntimeOnTaskService, createLockOnGetEngine, createLockOnGetEngine, createLockOnNewProcessInstance, getCacheManager, getDeploymentDescriptor, getEnvironment, getExecutionErrorManager, getIdentifier, getKieContainer, getTransactionManager, getTransactionManagerInternal, hasEnvironmentEntry, hasSecurityManager, isActive, isClosed, newTaskService, registerDisposeCallback, registerItems, releaseAndCleanLock, releaseAndCleanLock, removeRuntimeFromTaskService, setCacheManager, setDeploymentDescriptor, setEnvironment, setIdentifier, setKieContainer, setSecurityManager`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PerProcessInstanceRuntimeManager

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

  - ### Method Detail

    - #### getRuntimeEngine

          public org.kie.api.runtime.manager.RuntimeEngine getRuntimeEngine(org.kie.api.runtime.manager.Context<?> context)

    - #### signalEvent

          public void signalEvent(String type,
                                  Object event)

    - #### validate

          public void validate(org.kie.api.runtime.KieSession ksession,
                               org.kie.api.runtime.manager.Context<?> context)
                        throws IllegalStateException

      Throws:
        `IllegalStateException`

    - #### disposeRuntimeEngine

          public void disposeRuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine runtime)

    - #### softDispose

          public void softDispose(org.kie.api.runtime.manager.RuntimeEngine runtimeEngine)

      Description copied from class: `AbstractRuntimeManager`
      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
      Overrides:
        `softDispose` in class `AbstractRuntimeManager`

    - #### close

          public void close()

      Specified by:
        `close` in interface `org.kie.api.runtime.manager.RuntimeManager`
      Overrides:
        `close` in class `AbstractRuntimeManager`

    - #### validate

          public boolean validate(Long ksessionId,
                                  Long processInstanceId)

    - #### getFactory

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

      Specified by:
        `getFactory` in class `AbstractRuntimeManager`

    - #### 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 org.kie.api.runtime.manager.RuntimeEngine findLocalRuntime(Object processInstanceId)

    - #### saveLocalRuntime

          protected void saveLocalRuntime(Object processInstanceId,
                                          org.kie.api.runtime.manager.RuntimeEngine runtime)

    - #### removeLocalRuntime

          protected void removeLocalRuntime(org.kie.api.runtime.manager.RuntimeEngine runtime)

    - #### init

          public void init()

      Overrides:
        `init` in class `AbstractRuntimeManager`

    - #### activate

          public void activate()

      Specified by:
        `activate` in interface `org.kie.internal.runtime.manager.InternalRuntimeManager`
      Overrides:
        `activate` in class `AbstractRuntimeManager`

    - #### deactivate

          public void deactivate()

      Specified by:
        `deactivate` in interface `org.kie.internal.runtime.manager.InternalRuntimeManager`
      Overrides:
        `deactivate` in class `AbstractRuntimeManager`

    - #### isUseLocking

          protected boolean isUseLocking()

      Overrides:
        `isUseLocking` in class `AbstractRuntimeManager`

Copyright © 2001–2021 JBoss by Red Hat. All rights reserved.