[jboss-user] [jBPM] - Re: timer job issues when disposing session in embedded j2ee process

Jiri Svitak do-not-reply at jboss.com
Tue Jun 25 07:10:12 EDT 2013


Jiri Svitak [https://community.jboss.org/people/jsvitak] created the discussion

"Re: timer job issues when disposing session in embedded j2ee process"

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

--------------------------------------------------------------
Hi Umberto,
jBPM engine uses knowledge sessions for running process instances. Listeners are registered in the sessions. So your processes instance has not ended yet and you are trying to dispose its underlying session, which also contains your listener. That won't work.

So to solve the problem, I think that you should not try to dispose the session inside listener method. You should implement another (waiting) mechanism, which will dispose the session only when it is safe - when all process instances of the session are not running.

There are many patterns how to use sessions. For example:
- waiting mechanism, for example you can use waiting after startProcess() method, decrement CountDownLatch in the listener and after that dispose the session
- or you should not dispose the session when using timers (singleton session pattern) - because if you dispose session directly after startProcess(), the timer will not fire, because its session is not active
- ...

My two cents.
--------------------------------------------------------------

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

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/20130625/0241989c/attachment-0001.html 


More information about the jboss-user mailing list