atomikos的Jta配置
配置说明见:
http://www.atomikos.com/Documentation/JtaProperties
atomikos的一些配置,文档中说明的比较清楚,有两个属性配置不太明确:
com.atomikos.icatch.max_timeout、com.atomikos.icatch.default_jta_timeout都是关于事务超时的,验证了一下第一个配置有效的,当事务运行时间超过该时间配置时,会抛错。
com.atomikos.jdbc.AtomikosSQLException: Transaction is marked for rollback only or has timed out
at com.atomikos.jdbc.AtomikosSQLException.throwAtomikosSQLException(AtomikosSQLException.java:46)
at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:233)
at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:142)
at com.sun.proxy.$Proxy1.prepareStatement(Unknown Source)
at XAMain.modifyAccountBMoney(XAMain.java:117)
at XAMain.transeMoney(XAMain.java:65)
at XAMain.main(XAMain.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: com.atomikos.datasource.xa.session.InvalidSessionHandleStateException: Transaction is marked for rollback only or has timed out
at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:57)
at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:88)
at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:179)
at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:223)
... 10 more
而第二个参数则没什么用,查看开源的代码也没有看到使用第二个配置。