Class 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.
    • 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)
      • disposeRuntimeEngine

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

        protected org.kie.api.runtime.Environment getEnvironment​(org.kie.api.runtime.manager.RuntimeEngine runtimeEngine)
        Overrides:
        getEnvironment in class AbstractRuntimeManager
      • 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
      • 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)