[jboss-user] [jBPM] - reuse StatefulKnowledgeSession, is StatefulKnowledgeSession lightweight

Nick Tan do-not-reply at jboss.com
Mon Sep 26 01:17:36 EDT 2011

Nick Tan [http://community.jboss.org/people/missedone] created the discussion

"reuse StatefulKnowledgeSession, is StatefulKnowledgeSession lightweight"

To view the discussion, visit: http://community.jboss.org/message/628462#628462

hi, folks

i'm using jBPM5 and here is question about how to effectively use the StatefulKnowledgeSession.

is StatefulKnowledgeSession lightweight?

is there any potential risk if we implement the strategy that create StatefulKnowledgeSession for each request, that means, create StatefulKnowledgeSession when every time call startProcess, and dispose it after the process instance complete.

I read the javadoc of StatefulKnowledgeSession, it clear state that: "
After the application finishes using the session, though, it *must* call the dispose() method in order to free the resources and used memory.

at this monment, what i can image is that, if there are lots of active process instance not complete, that will cause lots of StatefulKnowledgeSession resources not released, which could be potential memory leak? is this correct?

do you guys have any best practice or pattern of useing StatefulKnowledgeSession? for example, options like:
reuse single StatefulKnowledgeSession?
reuse StatefulKnowledgeSession in a pool?
oneStatefulKnowledgeSession per request?


Reply to this message by going to Community

Start a new discussion in jBPM at Community

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

More information about the jboss-user mailing list