[jboss-user] [jBPM] - Re: BPMN Timers - threads and persistence

M Arnold do-not-reply at jboss.com
Mon Aug 20 12:32:40 EDT 2012


M Arnold [https://community.jboss.org/people/m_arnold123] created the discussion

"Re: BPMN Timers - threads and persistence"

To view the discussion, visit: https://community.jboss.org/message/754598#754598

--------------------------------------------------------------
I had a dig into jBPM source code, and found org.drools.time.impl.JDKTimerService.  It looks to me like jBPM5 uses the Java SE 6 
ExecutorService ( http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html).  

It would be an *extremely* useful enhancement if jBPM5 could be configured to use the Java EE TimerService.  ( http://docs.oracle.com/javaee/5/tutorial/doc/bnboy.html http://docs.oracle.com/javaee/5/tutorial/doc/bnboy.html).  I think using the ExecutorService will be fraught with problems in an HA + EJB3 environment.  If I can't find a solution I will have to create a custom workitemhandler just to allow processes to sleep for a configurable period of time (using the Timer Service) - but this obviously won't use the proper BPMN2 syntax.

I am left with the problem of how & when to dispose sessions, and how to load sessions from persistence when the cluster starts.  I thought I might try to use SFSBs to maintain the knowledge sessions while the cluster is up, and will use a @Startup SLSB to load the knowledge sessions from persistence which may have timers.  Has anyone had any luck doing anything similar?

I run each process in its own StatefulKnowledgeSession. If I call "pi = ksession.startProcessInstance(pi.getId());" can I use the pi.getState() to determine whether I can safely dispose the StatefulKnowledgeSession after the call?  ie. if getState == STATE_ABORTED || STATE_COMPLETED?  Any advice on how I can determine when a StatefulKnowledgeSession has no timers and therefore can be disposed?

This problems seem like they must be very common... hopefully someone has some advice!?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/754598#754598]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120820/fc84f8ae/attachment.html 


More information about the jboss-user mailing list