[jboss-user] [jBPM] - Re: Resources Handling on TaskClient in JBPM5

Andy Yeung do-not-reply at jboss.com
Tue Nov 8 22:43:31 EST 2011

Andy Yeung [http://community.jboss.org/people/andy.yeung] created the discussion

"Re: Resources Handling on TaskClient in JBPM5"

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

I have trace the code in CommandBasedWSHumanTaskHandler. I find that the KnowledgeRuntime pass in constructor is used by the callback handler in GetCompletedTaskResponseHandler and GetResultContentResponseHandler only. I remove that in constructor and add method registerHumanTaskSession(Long pTaskId, KnowledgeRuntime pSession) and deregisterHumanTaskSession(Long pTaskId) in it. Before I call TaskClient.completeTask, I first registerr the task id and correponding session in the CommandBasedWSHumanTaskHandler. In the callback, I change session.getWorkItemManager().completeWorkItem(workItemId, results) to sessionLookup.get(task.getId()).getWorkItemManager().completeWorkItem(workItemId, results);

In this way I can share the TaskClient and BlockingComamndBasedWSHumanTaskHandler by multiple process instance.

Also in the connect method,
I configure a flag and only let the registerForEvent execute once only. Otherwise multiple callback will be triggered since executeWorkItem call connect method implicitly.

I have tested this under 10 concurrent thread and seems having no problem in this way. But I am not sure if using a single TaskClient in BlockingCommandBasedWSHumanTaskHandler amongs all process instance affects performance.

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/20111108/8ea5132e/attachment.html 

More information about the jboss-user mailing list