Package org.jbpm.runtime.manager.impl

## Class PerCaseRuntimeManager

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

- All Implemented Interfaces:
    `org.kie.api.runtime.manager.RuntimeManager`, `org.kie.internal.runtime.manager.InternalRuntimeManager`

      public class PerCaseRuntimeManager
      extends AbstractRuntimeManager

  A RuntimeManager implementation that is backed by the "Per Case" strategy. This means that every process instance that belongs to same case will be bound to a single (case scoped) 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 implementation supports the following `Context` implementations:
  - ProcessInstanceIdContext
  - CaseContext

- - ### Field Summary

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

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

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PerCaseRuntimeManager​(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 | Description
    --- | --- | ---
    `void` | `activate()` |
    `void` | `close()` |
    `void` | `deactivate()` |
    `void` | `destroyCase​(org.kie.internal.runtime.manager.context.CaseContext caseContext)` |
    `void` | `disposeRuntimeEngine​(org.kie.api.runtime.manager.RuntimeEngine runtime)` |
    `protected org.kie.api.runtime.manager.RuntimeEngine` | `findLocalRuntime​(Object caseId)` |
    `org.drools.core.event.AbstractEventSupport<? extends EventListener>` | `getCaseEventSupport()` |
    `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` | `registerItems​(org.kie.api.runtime.manager.RuntimeEngine runtime)` |
    `protected void` | `removeLocalRuntime​(org.kie.api.runtime.manager.RuntimeEngine runtime)` |
    `protected void` | `removeLocalRuntime​(org.kie.api.runtime.manager.RuntimeEngine runtime, Long processInstanceId)` |
    `protected void` | `saveLocalRuntime​(Object caseId, Object processInstanceId, org.kie.api.runtime.manager.RuntimeEngine runtime)` |
    `void` | `setCaseEventSupport​(org.drools.core.event.AbstractEventSupport<? extends EventListener> caseEventSupport)` |
    `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.
    `boolean` | `validate​(Long ksessionId, Long processInstanceId)` |
    `void` | `validate​(org.kie.api.runtime.KieSession ksession, org.kie.api.runtime.manager.Context<?> context)` |

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

      `attachManager, canDestroy, canDispose, checkPermission, close, configureRuntimeOnTaskService, createLockOnGetEngine, createLockOnGetEngine, createLockOnNewProcessInstance, getCacheManager, getDeploymentDescriptor, getEntityManager, getEnvironment, getEnvironment, getExecutionErrorManager, getIdentifier, getKieContainer, getTransactionManager, getTransactionManagerInternal, hasEnvironmentEntry, hasMultipleProcessPerSession, hasSecurityManager, initTimerService, isActive, isClosed, newTaskService, registerDisposeCallback, 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`

    - ### Methods inherited from interface org.kie.internal.runtime.manager.InternalRuntimeManager

      `useContextMapping`

- - ### Constructor Detail

    - #### PerCaseRuntimeManager

          public PerCaseRuntimeManager​(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 caseId)

    - #### saveLocalRuntime

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

    - #### removeLocalRuntime

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

    - #### removeLocalRuntime

          protected void removeLocalRuntime​(org.kie.api.runtime.manager.RuntimeEngine runtime,
                                            Long processInstanceId)

    - #### 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`

    - #### destroyCase

          public void destroyCase​(org.kie.internal.runtime.manager.context.CaseContext caseContext)

    - #### getCaseEventSupport

          public org.drools.core.event.AbstractEventSupport<? extends EventListener> getCaseEventSupport()

    - #### setCaseEventSupport

          public void setCaseEventSupport​(org.drools.core.event.AbstractEventSupport<? extends EventListener> caseEventSupport)

    - #### isUseLocking

          protected boolean isUseLocking()

      Overrides:
        `isUseLocking` in class `AbstractRuntimeManager`

    - #### registerItems

          protected void registerItems​(org.kie.api.runtime.manager.RuntimeEngine runtime)

      Overrides:
        `registerItems` in class `AbstractRuntimeManager`