Globals.getPacketRouter(0).getHandler(
PacketType.ROLLBACK_TRANSACTION);
TransactionUID[] tuids = (TransactionUID[])conlist.toArray(new TransactionUID[0]);
for (int i = 0; i < tuids.length; i ++) {
tid = (TransactionUID) tuids[i];
TransactionState ts = Globals.getTransactionList().retrieveState(tid);
if (ts == null) {
// nothing to do if no transaction state
continue;
}
int tstate = ts.getState();
if (ts.getXid() != null) {
if (xaretainall) {
if (!xaretainallLogged) {
logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
BrokerResources.I_CONN_CLEANUP_RETAIN_XA));
xaretainallLogged = true;
}
continue;
}
if(tstate > TransactionState.COMPLETE) {
String[] args = { ""+tid+"(XID="+ts.getXid()+")",
TransactionState.toString(tstate),
getConnectionUID().toString() };
logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
BrokerResources.I_CONN_CLEANUP_KEEP_TXN, args));
continue;
}
if (tstate == TransactionState.INCOMPLETE ||
tstate == TransactionState.COMPLETE ) {
ts.detachedFromConnection();
timeoutTIDs.add(tid);
String[] args = { ""+tid+"(XID="+ts.getXid()+")",
TransactionState.toString(tstate),
getConnectionUID().toString() };
logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
BrokerResources.I_CONN_CLEANUP_KEEP_TXN, args));
continue;
}
}
if (tstate == TransactionState.PREPARED ||
tstate == TransactionState.COMMITTED ||
tstate == TransactionState.ROLLEDBACK) {
String[] args = { ""+tid,
TransactionState.toString(tstate),
getConnectionUID().toString() };
logger.log(Logger.INFO, Globals.getBrokerResources().getKString(
BrokerResources.I_CONN_CLEANUP_KEEP_TXN, args));
continue;
}
if (DEBUG || DEBUG_TXN) {
logger.log(Logger.INFO, "Cleanup connection ["+getConnectionUID()+
"]: cleaning up transaction "+tid+"["+TransactionState.toString(tstate)+"]");
}
try {
rollbackHandler.doRollback(tid, ts.getXid(), null, ts, conlist,
null, RollbackReason.CONNECTION_CLEANUP);
} catch (Exception e) {
String[] args = { ""+tid+"["+TransactionState.toString(tstate)+"]",
getConnectionUID().toString(), e.getMessage() };
logger.logStack(logger.WARNING,