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
[
http://community.jboss.org/message/635631#635631]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]