gonzalad
2013-02-19 13:18:11 UTC
gonzalad [https://community.jboss.org/people/gonzalad] created the discussion
"Re: jBPM 5.4 : LocalTaskService transaction handling with CMT transaction"
To view the discussion, visit: https://community.jboss.org/message/798337#798337
--------------------------------------------------------------
I changed TaskServiceSession implementation with the one attached.
The change is localized in the catch(Runtime re) showed in the previous post.
I've change it like this :
} catch (RuntimeException re) {
  Â
 tpm.rollBackTransaction(transactionOwner);
Â
Â
 if (transactionOwner) {
     doOperationInTransaction(new TransactedOperation() {
         public void doOperation() {
             task.getTaskData().setStatus(Status.Error);
         }
     });
 }
Â
Â
 throw re;
}
Â
Explanation:
* tpm.rollBackTransaction(transactionOwner) : this calls ut.setRollbackOnly(true) in the context of CMT transaction.
* if (transactionOwner) : updating task SGBD table cannot be done in a CMT transaction when rollback has been requested (we would need to start a new transaction for this).
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/798337#798337]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
"Re: jBPM 5.4 : LocalTaskService transaction handling with CMT transaction"
To view the discussion, visit: https://community.jboss.org/message/798337#798337
--------------------------------------------------------------
I changed TaskServiceSession implementation with the one attached.
The change is localized in the catch(Runtime re) showed in the previous post.
I've change it like this :
} catch (RuntimeException re) {
  Â
 tpm.rollBackTransaction(transactionOwner);
Â
Â
 if (transactionOwner) {
     doOperationInTransaction(new TransactedOperation() {
         public void doOperation() {
             task.getTaskData().setStatus(Status.Error);
         }
     });
 }
Â
Â
 throw re;
}
Â
Explanation:
* tpm.rollBackTransaction(transactionOwner) : this calls ut.setRollbackOnly(true) in the context of CMT transaction.
* if (transactionOwner) : updating task SGBD table cannot be done in a CMT transaction when rollback has been requested (we would need to start a new transaction for this).
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/798337#798337]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]