What does "TERMINATED" state of UserTransaction mean on Atomikos logs?
if (userTransaction.getStatus()== Status.STATUS_ACTIVE){
userTransaction.commit();
}
and then I see in the logs the following exception:
java.lang.IllegalStateException: TM_UNIQUE_NAME0003000006 is no longer active but in state TERMINATED at com.atomikos.icatch.imp.CoordinatorImp.addParticipant(CoordinatorImp.java:615) at com.atomikos.icatch.imp.TransactionStateHandler.addParticipant(TransactionStateHandler.java:133) at com.atomikos.icatch.imp.TransactionStateHandler.committed(TransactionStateHandler.java:347) at com.atomikos.icatch.imp.TransactionStateHandler.commit(TransactionStateHandler.java:298) at com.atomikos.icatch.imp.CompositeTransactionImp.doCommit(CompositeTransactionImp.java:319) at com.atomikos.icatch.imp.CompositeTerminatorImp.commit(CompositeTerminatorImp.java:79) at com.atomikos.icatch.jta.TransactionImp.commit(TransactionImp.java:236) at com.atomikos.icatch.jta.TransactionManagerImp.commit(TransactionManagerImp.java:496) at com.atomikos.icatch.jta.UserTransactionImp.commit(UserTransactionImp.java:129) at com.mycompany.module.view.myOtherClass.transformMp开发者_Go百科r(myOtherClass.java:57) at java.util.Observable.notifyObservers(Unknown Source) at com.mycompany.module.model.myClass.notifyObservers(myClass.java:291) at com.mycompany.module.model.myClass.MultiStateEscalation.run(myClass.java:91) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Where line 57 in the myOtherClass
is the line where I call commit()
in the above code. userTransaction is an instance of UserTransaction
.
javax.transaction.Status
.
Has someone incountered this? How can I check if the userTransaction I'm holding is valid for commit?
Thanks,
IttaiTERMINATED means committed or rolled back. In your case, most likely a timeout / rollback.
Try increasing the timeout if you can.
In general, checking the transaction state does not guarantee that the next line of code can commit. Committing is an application request that can fail due to timeouts and resource issues; otherwise you wouldn't need two-phase-commit :-)
Best
精彩评论