1 Reply Latest reply on Mar 17, 2010 9:40 AM by elfuhrer

    performance problem with jbpm enabled in the seam

    Richard Qin Newbie

      When jbpm is enabled in the seam, the initialization of seam component will invoke the ProcessInstance.getProcessInstance, it invoke the JbpmContext.getProcessInstanceForUpdate to add the processInstance to the autoSaveProcessInstances.

        public void addAutoSaveProcessInstance(ProcessInstance processInstance)
          if (autoSaveProcessInstances == null)
            autoSaveProcessInstances = new ArrayList();

      Because autoSaveProcessInstances is a List type field of JbpmContext, so the same processInstance can be added repeatedly. when app has many related seam components, this will cause a lot of same processinstance put into autoSaveProcessInstances list.
      When jbpmContext close, it will save all the instances in the autoSaveProcessInstances, which raise performance issues.

      if (autoSaveProcessInstances != null)
            Iterator iter = autoSaveProcessInstances.iterator();
            while (iter.hasNext())
              ProcessInstance processInstance = (ProcessInstance)iter.next();

      Any suggestions are greatly appreciated.