[jboss-user] [jBPM] - Re: JBPM 5.4.0-Final: Human Task variable mapping is not working

Maciej Swiderski do-not-reply at jboss.com
Wed Jan 9 13:11:50 EST 2013

Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: JBPM 5.4.0-Final: Human Task variable mapping is not working"

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

The issue here is that LocalHTWorkItemHandler has single (always active) instance of LocalTaskService and unfortunately it is shared with TaskCompletedHandler (that is inherited from GenericHTHandler). Which puts us in situation where after some time task is about to be completed and to do so new LocalTaskService instance is created that does the complete operation on task service and sends an event to the runtime engine. That event is received by TaskCompletedHandler and uses LocalTaskService instance from LocalHTWorkItemHandler. That gives us:
1. new instance of LocalTaskService (LTS1) that is created to complete task with persistence context PC1
2. always active instance of LocalTaskService (LTS2) taken from LocalHTWorkItemHandler inside TaskCompletedHandler class which was persistence context PC2

when LTS2 checks task status by loading it from db (PC2) it has out of date information as the LTC1 has not yet committed it's changes (flushed from PC1) and thus proceeding with abort of work item handler.

A workaround for this would be to extend LocalHTWorkItemHandler and override registerForEvent method to register your own TaskCompletedHandler that will get new LocalTaskService for every event it is going to process. With that persistence contexts will be shared on hibernate session level since they run as part of the same JTA transaction and where created for that transaction.


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/20130109/4937b77a/attachment.html 

More information about the jboss-user mailing list