org.jbpm.runtime.manager.impl

## Class PerRequestRuntimeManager

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

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

      public class PerRequestRuntimeManager
      extends AbstractRuntimeManager

  A RuntimeManager implementation that is backed by the "Per Request" strategy. This means that for every call to `getRuntimeEngine`, a new instance will be delivered with brand new KieSession and TaskService. The only exception to this is when this is invoked within the same transaction from different places. In that case, the manager caches the currently active instance in a ThreadLocal instane to avoid concurrent modifications or "loss" of data. Disposing of the runtime engine manager will ensure that it is destroyed as well, so that it will get removed from the database to avoid outdated data.
  This implementation does not require any special `Context` to proceed.

- - ### Field Summary

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

      `cacheManager, closed, deploymentDescriptor, engineInitEager, engineLocks, environment, identifier, kieContainer, registry, securityManager`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PerRequestRuntimeManager(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` | `close()`
    `void` | `disposeRuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine runtime)`
    `org.kie.internal.runtime.manager.SessionFactory` | `getFactory()`
    `org.kie.api.runtime.manager.RuntimeEngine` | `getRuntimeEngine(org.kie.api.runtime.manager.Context<?> context)`
    `org.kie.internal.runtime.manager.TaskServiceFactory` | `getTaskServiceFactory()`
    `void` | `init()`
    `void` | `setFactory(org.kie.internal.runtime.manager.SessionFactory factory)`
    `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)`

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

      `activate, attachManager, canDestroy, canDispose, checkPermission, close, configureRuntimeOnTaskService, createLockOnGetEngine, createLockOnGetEngine, createLockOnNewProcessInstance, deactivate, getCacheManager, getDeploymentDescriptor, getEnvironment, getIdentifier, getKieContainer, getTransactionManager, getTransactionManagerInternal, hasEnvironmentEntry, isActive, isClosed, isUseLocking, 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

    - #### PerRequestRuntimeManager

          public PerRequestRuntimeManager(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`

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

    - #### init

          public void init()

      Specified by:
        `init` in class `AbstractRuntimeManager`

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