Package org.flowable.engine

# Class ProcessEngines

java.lang.Object
org.flowable.engine.ProcessEngines

public abstract class ProcessEngines extends Object
Helper for initializing and closing process engines in server environments.
All created `ProcessEngine`s will be registered with this class.
The flowable-webapp-init webapp will call the `init()` method when the webapp is deployed and it will call the `destroy()` method when the webapp is destroyed, using a context-listener ( `org.flowable.impl.servlet.listener.ProcessEnginesServletContextListener` ). That way, all applications can just use the `getProcessEngines()` to obtain pre-initialized and cached process engines.
Please note that there is no lazy initialization of process engines, so make sure the context-listener is configured or `ProcessEngine`s are already created so they were registered on this class.
The `init()` method will try to build one `ProcessEngine` for each flowable.cfg.xml file found on the classpath. If you have more then one, make sure you specify different process.engine.name values.

Author:
  Tom Baeyens, Joram Barrez

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static boolean`
  `isInitialized`
  `static final String`
  `NAME_DEFAULT`
  `protected static List<org.flowable.common.engine.impl.EngineInfo>`
  `processEngineInfos`
  `protected static Map<String,org.flowable.common.engine.impl.EngineInfo>`
  `processEngineInfosByName`
  `protected static Map<String,org.flowable.common.engine.impl.EngineInfo>`
  `processEngineInfosByResourceUrl`
  `protected static Map<String,ProcessEngine>`
  `processEngines`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProcessEngines()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `destroy()`
  closes all process engines.
  `static ProcessEngine`
  `getDefaultProcessEngine()`
  `static ProcessEngine`
  `getProcessEngine(String processEngineName)`
  obtain a process engine by name.
  `static org.flowable.common.engine.impl.EngineInfo`
  `getProcessEngineInfo(String processEngineName)`
  Get initialization results.
  `static List<org.flowable.common.engine.impl.EngineInfo>`
  `getProcessEngineInfos()`
  Get initialization results.
  `static Map<String,ProcessEngine>`
  `getProcessEngines()`
  provides access to process engine to application clients in a managed server environment.
  `static void`
  `init()`
  Initializes all process engines that can be found on the classpath for resources `flowable.cfg.xml` (plain Flowable style configuration) and for resources `flowable-context.xml` (Spring style configuration).
  `protected static void`
  `initProcessEngineFromSpringResource(URL resource)`
  `static boolean`
  `isInitialized()`
  `static void`
  `registerProcessEngine(ProcessEngine processEngine)`
  Registers the given process engine.
  `static org.flowable.common.engine.impl.EngineInfo`
  `retry(String resourceUrl)`
  retries to initialize a process engine that previously failed.
  `static void`
  `setInitialized(boolean isInitialized)`
  `static void`
  `unregister(ProcessEngine processEngine)`
  Unregisters the given process engine.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NAME_DEFAULT

    public static final String NAME_DEFAULT
    See Also:
      - Constant Field Values

  - ### isInitialized

    protected static boolean isInitialized

  - ### processEngines

    protected static Map<String,ProcessEngine> processEngines

  - ### processEngineInfosByName

    protected static Map<String,org.flowable.common.engine.impl.EngineInfo> processEngineInfosByName

  - ### processEngineInfosByResourceUrl

    protected static Map<String,org.flowable.common.engine.impl.EngineInfo> processEngineInfosByResourceUrl

  - ### processEngineInfos

    protected static List<org.flowable.common.engine.impl.EngineInfo> processEngineInfos

- ## Constructor Details

  - ### ProcessEngines

    public ProcessEngines()

- ## Method Details

  - ### init

    public static void init()
    Initializes all process engines that can be found on the classpath for resources `flowable.cfg.xml` (plain Flowable style configuration) and for resources `flowable-context.xml` (Spring style configuration).

  - ### initProcessEngineFromSpringResource

    protected static void initProcessEngineFromSpringResource(URL resource)

  - ### registerProcessEngine

    public static void registerProcessEngine(ProcessEngine processEngine)
    Registers the given process engine. No `EngineInfo` will be available for this process engine. An engine that is registered will be closed when the `destroy()` is called.

  - ### unregister

    public static void unregister(ProcessEngine processEngine)
    Unregisters the given process engine.

  - ### getProcessEngineInfos

    public static List<org.flowable.common.engine.impl.EngineInfo> getProcessEngineInfos()
    Get initialization results.

  - ### getProcessEngineInfo

    public static org.flowable.common.engine.impl.EngineInfo getProcessEngineInfo(String processEngineName)
    Get initialization results. Only info will we available for process engines which were added in the `init()`. No `EngineInfo` is available for engines which were registered programmatically.

  - ### getDefaultProcessEngine

    public static ProcessEngine getDefaultProcessEngine()

  - ### getProcessEngine

    public static ProcessEngine getProcessEngine(String processEngineName)
    obtain a process engine by name.
    Parameters:
      `processEngineName` - is the name of the process engine or null for the default process engine.

  - ### retry

    public static org.flowable.common.engine.impl.EngineInfo retry(String resourceUrl)
    retries to initialize a process engine that previously failed.

  - ### getProcessEngines

    public static Map<String,ProcessEngine> getProcessEngines()
    provides access to process engine to application clients in a managed server environment.

  - ### destroy

    public static void destroy()
    closes all process engines. This method should be called when the server shuts down.

  - ### isInitialized

    public static boolean isInitialized()

  - ### setInitialized

    public static void setInitialized(boolean isInitialized)