Class ActiveMQXAResourceWrapper
java.lang.Object
org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQXAResourceWrapper
- All Implemented Interfaces:
XAResource, org.apache.activemq.artemis.api.core.client.SessionFailureListener, org.apache.activemq.artemis.core.remoting.FailureListener
public class ActiveMQXAResourceWrapper
extends Object
implements XAResource, org.apache.activemq.artemis.api.core.client.SessionFailureListener
XAResourceWrapper.
Mainly from org.jboss.server.XAResourceWrapper from the JBoss AS server module
The reason why we don't use that class directly is that it assumes on failure of connection the RM_FAIL or RM_ERR is thrown, but in Apache Artemis we throw XA_RETRY since we want the recovery manager to be able to retry on failure without having to manually retry
-
Field Summary
Fields inherited from interface XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeReconnect(org.apache.activemq.artemis.api.core.ActiveMQException me) protected XAExceptioncheck(XAException e) Check whether an XAException is fatal.voidclose()Close the connectionvoidprotected XAResourceconnect()Connect to the server if not already done sovoidconnectionFailed(org.apache.activemq.artemis.api.core.ActiveMQException me, boolean failedOver) voidconnectionFailed(org.apache.activemq.artemis.api.core.ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID) voidvoidintbooleanisSameRM(XAResource xaRes) intXid[]recover(int flag) voidbooleansetTransactionTimeout(int seconds) voidtoString()voidupdateRecoveryConfig(XARecoveryConfig... xaRecoveryConfigs)
-
Constructor Details
-
ActiveMQXAResourceWrapper
-
-
Method Details
-
updateRecoveryConfig
-
recover
- Specified by:
recoverin interfaceXAResource- Throws:
XAException
-
commit
- Specified by:
commitin interfaceXAResource- Throws:
XAException
-
rollback
- Specified by:
rollbackin interfaceXAResource- Throws:
XAException
-
forget
- Specified by:
forgetin interfaceXAResource- Throws:
XAException
-
isSameRM
- Specified by:
isSameRMin interfaceXAResource- Throws:
XAException
-
prepare
- Specified by:
preparein interfaceXAResource- Throws:
XAException
-
start
- Specified by:
startin interfaceXAResource- Throws:
XAException
-
end
- Specified by:
endin interfaceXAResource- Throws:
XAException
-
getTransactionTimeout
- Specified by:
getTransactionTimeoutin interfaceXAResource- Throws:
XAException
-
setTransactionTimeout
- Specified by:
setTransactionTimeoutin interfaceXAResource- Throws:
XAException
-
connectionFailed
public void connectionFailed(org.apache.activemq.artemis.api.core.ActiveMQException me, boolean failedOver) - Specified by:
connectionFailedin interfaceorg.apache.activemq.artemis.core.remoting.FailureListener
-
connectionFailed
public void connectionFailed(org.apache.activemq.artemis.api.core.ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID) - Specified by:
connectionFailedin interfaceorg.apache.activemq.artemis.core.remoting.FailureListener
-
beforeReconnect
public void beforeReconnect(org.apache.activemq.artemis.api.core.ActiveMQException me) - Specified by:
beforeReconnectin interfaceorg.apache.activemq.artemis.api.core.client.SessionFailureListener
-
connect
Connect to the server if not already done so- Returns:
- the connectionFactory XAResource
- Throws:
Exception- for any problem
-
toString
-
close
public void close()Close the connection -
check
Check whether an XAException is fatal. If it is an RM problem we close the connection so the next call will reconnect.- Parameters:
e- the xa exception- Returns:
- never
- Throws:
XAException- always
-