-
1. Re: how to save processinstance
mputz May 22, 2007 4:59 AM (in response to cron1)Look at the javadoc for JbpmContext to see the correct usage of JbpmContext. jbpmContext.close() should always be called within a finally clause. This ensures that the Hibernate session and connection is properly closed.
Regards, Martin -
2. Re: how to save processinstance
cron1 May 22, 2007 6:19 AM (in response to cron1)I have seen the javadoc before, and I can't use jbpm in that way because if you close a jbpmContext, you must reactive it by call createJBpmContext(), which is a resource costing process for applications. if we do that, the system will be very slowly.
our system have 100-300 clients accessed cocurrentlly. -
3. Re: how to save processinstance
kukeltje May 22, 2007 7:26 AM (in response to cron1)So you want a webapplication with saving all data each step but without any overhead. Keeping a context open lead to lots of other issues with none-connection oriented webapps. e.g. When do you close it if the user just click the x on his browser? When the session times-out? In that case it is also resource intensive but in another way.
100-300 clients accessing concurrently to me is <1 db query per second, so I do not realy see a problem there
Creating and opening a context each time should not be expensive (depending on , creating a JbpmConfiguration each time is. -
4. Re: how to save processinstance
mputz May 22, 2007 7:27 AM (in response to cron1)Creating a jbpmContext is a lightweight operation, basically it is a wrapper for a Hibernate transaction.
Regards, Martin -
5. Re: how to save processinstance
estaub May 22, 2007 8:31 AM (in response to cron1)cron,
I think the key question is: "what happens next"?
If you're going to synchronously continue processing on the same process instance, then did you really need to commit it to the db at this point in time? If not, then don't do anything - just close it later. JBPM generally takes this approach - if multiple nodes and transitions can be executed synchronously, by default it won't commit any until all are done. This is a lot more efficient because it allows object caching across nodes within the transaction.
If you're thinking that you want to keep the context open across multiple user interactions, as Ronald said, that's generally bad web-app practice - it scales badly.
-Ed Staub -
6. Re: how to save processinstance
cron1 May 23, 2007 6:22 AM (in response to cron1)Creating a jbpmContext is a lightweight operation, basically it is a wrapper for a Hibernate transaction. ????? I was confused before . now I see.
persistence object ????? I know it is a good idea, I mean the web application close the context after the processinstance.close(); so the whole workflow instance will close, but not to commit the data after a certain node.
however, there is a problem: after one thread of instance process has ended, the other clients will lose the jbpmContext after the client end the context. The root cause is that the jbpmContext is existed in a static class.
So I changed the code from static class to a constructor one, which instance a new one every time when the web application thread requested. then more problems came because every instance of it contains a separate jbpmContext, thus a separate jbpmSession, thus a separate Persistence Object(PO). The result turned out that different clients get different result. If one changed something, the other swinlane can't see any thing changed. if one want to getSession.flush(), he will find that tables were locked by the other jbpmContext.
Do jBPM only permit one jbpmContext in a web application ?
If you're thinking that you want to keep the context open across multiple user interactions, as Ronald said, that's generally bad web-app practice - it scales badly. ?????? ?jbpm doesn't support in the scenario of multiple web-application-user interactions? -
7. Re: how to save processinstance
kukeltje May 23, 2007 6:37 AM (in response to cron1)The context should not be shared!!! Open it and close it per webrequest as you mention further on. What do you mean by different PO's for different clients? Do they all work on the same processinstance at the same time? Or do you have multiple tasks parallel tasks for different actors? In that case the taskvariables are created at the moment the task is created with the values of processvariables of that moment. Changes in those are not reflected in the already created tasks.
-
8. Re: how to save processinstance
cron1 May 23, 2007 10:11 PM (in response to cron1)There several actors do the workflow instance in the same phase of node or different task which execute by different swimlane. in that case, taskvariables can't be shared ?
the context can not be shared ? oh My God. -
9. Re: how to save processinstance
kukeltje May 24, 2007 3:34 AM (in response to cron1)Oh jesus, what a complaints.....
Yes they can, by not declaring variables on the tasknodes you have access to the processcontext variables. Those are shared -
10. Re: how to save processinstance
kamleshkr May 12, 2008 3:25 AM (in response to cron1)"JBPM generally takes this approach - if multiple nodes and transitions can be executed synchronously, by default it won't commit any until all are done."
Can you tell me how to change this default behaviour of jBPM?. I want to save the processinstance after execution of each node. Can i do anything in actionhandler for that?