Information Technology Reference
In-Depth Information
Per Request Runtime Manager
The Per Request Runtime Manager does the opposite of the singleton instance; it creates
a new KIE session the first time a request is made in a particular thread. Each runtime en-
gine returned from the manager will have a new KIE session for the duration of the thread,
as the following diagram depicts:
The jBPM6 code base provides a factory method to create a Per Request Runtime Manager.
A code section from the per-request-runtime-manager project for this chapter
where that factory method is being used is shown here:
RuntimeManager manager = RuntimeManagerFactory.
Factory.get().
newPerRequestRuntimeManager (
runtimeEnvironment, "node-identifier");
As you can see, it receives two parameters. The second one is optional, and it identifies a
runtime manager uniquely, in the same way as we explained for the Singleton Runtime
Manager.
The get factory method instantiates a PerRequestRuntimeManager object. This ob-
ject will keep a ThreadLocal reference pointing to the KIE session in one particular
thread. If it is a nonpersistent environment, the reference will be lost the moment the
Search WWH ::




Custom Search