1 Reply Latest reply on May 17, 2006 5:30 AM by Tom Baeyens

    Automatic ProcessInstance presistancy when JbpmContext is cr

    Philip Yuen Newbie

      Hello all,

      I am trying to write a class to wrap up jBPM for my project development use. My program requires execution a huge number of small and short jbpm processes. By making some of these processes as non-presistant, it will keep jBPM database small. In this case, it will keep on switching between presistant process instances and non-presistant process instances.

      I am trying to create a JbpmContext using JbpmConfiguration.createJbpmContext() in constructor. I write like this coz I don't want to create a new JbpmContext everytime I execute Jbpm stuff, to save up some execution time.

      This method works fine until I need non-presistant Process Instance. Even if I use new ProcessInstance(processDefinition) instead of JbpmContext.newProcessInstance(processDefinition), it will still leave records into the database. By further looking into the codes, in Services.assignId(), it will call JbpmContext.getCurrentJbpmContext() and get a presistant service. as far as I understand from the codes, if I have created a JbpmContext, all of my process instances will be presisted into the database.

      Currently I will create a JbpmContext each time when I need presistant service, and close it immediately after use. This method works, but creation JbpmContext everytime I use may unnecessarily consume resources. May I know if there are any explicit ways to set a process instance to be presistant or non-presistant?