Information Technology Reference
In-Depth Information
Singleton Runtime Manager
The Singleton Runtime Manager makes sure a single KIE Session is used for all interac-
tions with the runtime engine, as shown in the following diagram:
The jBPM6 code base provides a factory method to create a Singleton Runtime Manager. A
code section from the singleton-runtime-manager project for this chapter where
this factory method is being used is shown here:
RuntimeManager manager = RuntimeManagerFactory.
Factory.get().
newSingletonRuntimeManager (
runtimeEnvironment, "node-identifier");
As you can see, it receives two parameters. The second one is optional, and it identifies a
runtime manager uniquely. Given that runtime managers should behave as singletons, the
factory keeps a register of all runtime managers until they're closed to make sure that you
cannot instantiate the same runtime manager twice.
The get factory method mentioned before will instantiate a SingletonRuntimeMan-
ager object. This object stores a file with the KIE session ID that should be used. Every
time a new instance of SingletonRuntimeManager is created, it checks if that file is
Search WWH ::




Custom Search