//convert to jmq xid
JMQXid jmqXid = new JMQXid(foreignXid);
//System.out.println("MQRA:XAR4MC:rollback():mcId="+mc.getMCId()+":xid="+jmqXid.toString());
//Debug.println("MQRA:XAR4RA:rollback():tid="+transactionID+" xid="+jmqXid.toString());
XASessionImpl xas = null;
SessionAdapter sa = null;
try {
//send rollback w/redeliver
if (!epConnection._isClosed()) {
//System.out.println("MQRA:XAR4MC:rollback:Using epCon");
sa = mc.getConnectionAdapter().getSessionAdapter();
if (epConnection.isConnectedToHABroker()) {
//handle fail-over for HA connection
HARollback(jmqXid);
} else {
epConnection.getProtocolHandler().rollback(0L, jmqXid, true);
}
if (sa != null) {
//System.out.println("MQRA:XAR4MC:rollback:sa!=null");
//sa.getXASession()._finishXATransactionForMC();
xas = sa.getXASession();
xas._finishXATransactionForMC();
}
active = false;
} else {
System.err.println("MQRA:XARFMC:rollback:ConnectionClosed:Rollback txn:xid="+jmqXid.toString());
//Debug.println("*=*=*=*=*=*=*=*=*=*=XAR:prepare:XAException:RMFAIL");
XAException xae = new XAException(XAException.XAER_RMFAIL);
throw xae;
}
} catch (Exception jmse) {
System.err.println("MQRA:XARFMC:rollback:XAException-Exception="+jmse.getMessage());
//Debug.println("*=*=*=*=*=*=*=*=*=*=XAR:rollbackXAException");
Debug.printStackTrace(jmse);
XAException xae = new XAException(XAException.XAER_RMFAIL);
xae.initCause(jmse);
throw xae;
} finally {
if ( sa != null ) {
xas = sa.getXASession();
if (xas != null) {
xas.failoverOccurred = false;
}
}