// ensure immtable and correct equals method.
XAXactId xid_im = new XAXactId(xid);
XATransactionState tranState = getTransactionState(xid_im);
if (tranState == null) {
XAResourceManager rm = ra.getXAResourceManager();
ContextManager inDoubtCM = rm.find(xid);
// RM also does not know about this xid.
if (inDoubtCM == null)
throw new XAException(XAException.XAER_NOTA);
ContextService csf = ContextService.getFactory();
csf.setCurrentContextManager(inDoubtCM);
try {
rm.forget(inDoubtCM, xid_im);
// close the connection/transaction since it can never be used again.
inDoubtCM.cleanupOnError(StandardException.closeException());
return;
} catch (StandardException se) {