// 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.commit(inDoubtCM, xid_im, onePhase);
// close the connection/transaction since it can never
// be used again. DERBY-4856 No extended diagnostic information needed.
inDoubtCM.cleanupOnError(StandardException.closeException(),
false);