throw new HornetQXAException(XAException.XAER_PROTO, msg);
}
else
{
Transaction theTx = resourceManager.removeTransaction(xid);
if (isTrace)
{
HornetQServerLogger.LOGGER.trace("XAcommit into " + theTx + ", xid=" + xid);
}
if (theTx == null)
{
// checked heuristic committed transactions
if (resourceManager.getHeuristicCommittedTransactions().contains(xid))
{
throw new HornetQXAException(XAException.XA_HEURCOM,
"transaction has been heuristically committed: " + xid);
}
// checked heuristic rolled back transactions
else if (resourceManager.getHeuristicRolledbackTransactions().contains(xid))
{
throw new HornetQXAException(XAException.XA_HEURRB,
"transaction has been heuristically rolled back: " + xid);
}
else
{
if (isTrace)
{
HornetQServerLogger.LOGGER.trace("XAcommit into " + theTx + ", xid=" + xid + " cannot find it");
}
throw new HornetQXAException(XAException.XAER_NOTA, "Cannot find xid in resource manager: " + xid);
}
}
else
{
if (theTx.getState() == Transaction.State.SUSPENDED)
{
// Put it back
resourceManager.putTransaction(xid, theTx);
throw new HornetQXAException(XAException.XAER_PROTO, "Cannot commit transaction, it is suspended " + xid);
}
else
{
theTx.commit(onePhase);
}
}
}
}