“终止”是什么意思? Atomikos 日志上 UserTransaction 的状态意味着什么?

发布于 2024-10-08 12:18:14 字数 2250 浏览 3 评论 0原文


我在 J2SE 应用程序中使用 Atomikos 基本事务作为我的 TM。
我有以下代码:

if (userTransaction.getStatus()== Status.STATUS_ACTIVE){
userTransaction.commit();
}

然后我在日志中看到以下异常:

java.lang.IllegalStateException: TM_UNIQUE_NAME0003000006 不再有效,但 处于已终止状态 com.atomikos.icatch.imp.CoordinatorImp.addParticipant(CoordinatorImp.java:615) 在 com.atomikos.icatch.imp.TransactionStateHandler.addParticipant(TransactionStateHandler.java:133) 在 com.atomikos.icatch.imp.TransactionStateHandler.commited(TransactionStateHandler.java:347) 在 com.atomikos.icatch.imp.TransactionStateHandler.commit(TransactionStateHandler.java:298) 在 com.atomikos.icatch.imp.CompositeTransactionImp.doCommit(CompositeTransactionImp.java:319) 在 com.atomikos.icatch.imp.CompositeTerminatorImp.commit(CompositeTerminatorImp.java:79) 在 com.atomikos.icatch.jta.TransactionImp.commit(TransactionImp.java:236) 在 com.atomikos.icatch.jta.TransactionManagerImp.commit(TransactionManagerImp.java:496) 在 com.atomikos.icatch.jta.UserTransactionImp.commit(UserTransactionImp.java:129) 在 com.mycompany.module.view.myOtherClass.transformMpr(myOtherClass.java:57) 在 java.util.Observable.notifyObservers(未知 来源)位于 com.mycompany.module.model.myClass.notifyObservers(myClass.java:291) 在 com.mycompany.module.model.myClass.MultiStateEscalation.run(myClass.java:91) 在 java.util.concurrent.Executors$RunnableAdapter.call(未知 来源)位于 java.util.concurrent.FutureTask$Sync.innerRun(未知 来源)位于 java.util.concurrent.FutureTask.run(未知 来源)于 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(未知 来源)于 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(未知 来源)于 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(未知 来源)位于 java.util.concurrent.ThreadPoolExecutor$Worker.run(未知 来源)于 java.lang.Thread.run(来源不明)

myOtherClass 中的第 57 行是我在上面的代码中调用 commit() 的行。 userTransaction 是 UserTransaction 的一个实例。
我不明白终止是什么意思?我在 Atomikos 发行版中找不到这些类(这很奇怪,因为它们是开源的,而且我还对所有源中的字符串进行了文本搜索)并且终止不是 javax.transaction 中定义的状态之一.状态.
有人遇到过这个吗?如何检查我持有的 userTransaction 是否对于提交有效?

谢谢,
一泰

I'm using Atomikos essential transactions as my TM in my J2SE application.
I have the following code:

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.transformMpr(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.
What I can't understand is what does TERMINATED means? I couldn't find these classes in the Atomikos distribution (which is weird since their open source and I additionaly ran a text search for the string over all the sources) and terminated is not one of the statuses defined in javax.transaction.Status.
Has someone incountered this? How can I check if the userTransaction I'm holding is valid for commit?

Thanks,
Ittai

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝眼睛不忧郁 2024-10-15 12:18:14

TERMINATED 意味着已提交或已回滚。在你的情况下,很可能是超时/回滚。

如果可以的话尝试增加超时。

一般来说,检查事务状态并不能保证下一行代码可以提交。提交是一个应用程序请求,可能会由于超时和资源问题而失败;否则你不需要两阶段提交:-)

最好

TERMINATED 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文