[jboss-user] [jBPM] New message: "Possible performance problem caused by autoSaveProcessInstances"

Richard Qin do-not-reply at jboss.com
Wed Mar 10 04:50:44 EST 2010


User development,

A new message was posted in the thread "Possible performance problem caused by autoSaveProcessInstances":

http://community.jboss.org/message/531003#531003

Author  : Richard Qin
Profile : http://community.jboss.org/people/richard.qin

Message:
--------------------------------------------------------------
autoSaveProcessInstances is a List type field of JbpmContext class, which contains the processInstance needed to persistent to database.
 
List autoSaveProcessInstances = null;

 
Due to the List type of autoSaveProcessInstances, the same processInstance can be repeatedly added to autoSaveProcessInstances by JbpmContext.addAutoSaveProcessInstance method.
 
  public void addAutoSaveProcessInstance(ProcessInstance processInstance)
  {
    if (autoSaveProcessInstances == null)
      autoSaveProcessInstances = new ArrayList();
    autoSaveProcessInstances.add(processInstance);
  }

 
When invoked by JbpmContext.close method, JbpmContext.autoSave will iterate each processInstance in the autoSaveProcessInstances to save, thus the processInstance be saved repeatedly.
 
  void autoSave()
  {
    if (autoSaveProcessInstances != null)
    {
      Iterator iter = autoSaveProcessInstances.iterator();
      while (iter.hasNext())
      {
        ProcessInstance processInstance = (ProcessInstance)iter.next();
        save(processInstance);
        iter.remove();
      }
    }
  }

 
In my web app based seam 2.2.0, jbpm 3.2.5.sp5, a jsf request will cause the same processInstance to be saved more than 2000 times. How about change the List type of autoSaveProcessInstances to the Set type? Any suggestion are greatly appreciated.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/531003#531003




More information about the jboss-user mailing list