简体   繁体   English

Java - 启发式异常

[英]Java - Heuristic Exception

Can anyone share how to generate or simulate HeuristicCommitException using Atomikos? 任何人都可以分享如何使用Atomikos生成或模拟HeuristicCommitException吗?

Thanks. 谢谢。

I think you could create your own implementation of XAResource ( http://docs.oracle.com/javaee/7/api/javax/transaction/xa/XAResource.html ) which you would enlist to the Atomikos global transaction. 我认为您可以创建自己的XAResource实现( http://docs.oracle.com/javaee/7/api/javax/transaction/xa/XAResource.html ),您将参与Atomikos全球事务。 Then during commit (commit phase of 2PC) you leave a first resource to be committed and your XAResource goes as second in the row. 然后在提交(2PC的提交阶段)期间,您将保留第一个要提交的资源,并且您的XAResource将作为行中的第二个。 Then your one throws, I think, XAException.XA_HEURRB ( https://docs.oracle.com/javase/7/docs/api/javax/transaction/xa/XAException.html#XA_HEURRB ) (implementing commit method to throw it). 然后你的XAException.XA_HEURRB抛出,我想, XAException.XA_HEURRBhttps://docs.oracle.com/javase/7/docs/api/javax/transaction/xa/XAException.html#XA_HEURRB )(实现commit方法抛出它) 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM