Activiti
  1. Activiti
  2. ACT-473

ProcessEngineFactoryBean fails to register created process engine properly

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.2
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Linux 2.6.35-23-generic #41-Ubuntu SMP Wed Nov 24 10:18:49 UTC 2010 i686 GNU/Linux
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      When org.activiti.spring.ProcessEngineFactoryBean creates new org.activiti.engine.impl.ProcessEngineImpl, the latter registers itself using org.activiti.engine.ProcessEngines#registerProcessEngine, which is fine. But at the moment org.activiti.engine.ProcessEngines is not initialized, so first call to any of org.activiti.engine.ProcessEngines#get* methods caused lazy ProcessEngines initialization, effectively discarding previously register engine.

      Patch to fix this issue is included. The temporary workaround is to initialize the ProcessEngines eagerly before any of {{ProcessEngineFactoryBean}}s are invoked:

      <bean id="initProcessEngines" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
      	<property name="staticMethod" value="org.activiti.engine.ProcessEngines.init"/>
      </bean>
      <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" depends-on="initProcessEngines">
      	...
      </bean>
      
      1. ACT.patch
        0.6 kB
        Tomasz Nurkiewicz

        Activity

        Hide
        Frederik Heremans added a comment -

        The workaround will cause an infinite lock when ProcessEngines is initlized, since all engines 'discovered' while initializing the engine, will register themselves. Since the initialization is synchronised and not yet finished by the time of calling registerProcessEngine, init() will be called agian, which will cause a lock.

        Show
        Frederik Heremans added a comment - The workaround will cause an infinite lock when ProcessEngines is initlized, since all engines 'discovered' while initializing the engine, will register themselves. Since the initialization is synchronised and not yet finished by the time of calling registerProcessEngine, init() will be called agian, which will cause a lock.
        Hide
        Frederik Heremans added a comment -

        As a solution, the map of registered engines won't be created again when init is called (unless it's null off course) to prevent custom registered engines to be lost.

        The destroy() method will clear this map, so calling init() after a destroy, will still work as intended.

        Show
        Frederik Heremans added a comment - As a solution, the map of registered engines won't be created again when init is called (unless it's null off course) to prevent custom registered engines to be lost. The destroy() method will clear this map, so calling init() after a destroy, will still work as intended.

          People

          • Assignee:
            Frederik Heremans
            Reporter:
            Tomasz Nurkiewicz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: