}
private TransactionInformation addTransactionID(TransactionUID id,
TransactionState ts, boolean takeover, int type, boolean persist)
throws BrokerException {
JMQXid xid = ts.getXid();
shareLock.lock();
try {
if (inuse_translist.contains(id)) {
if (!takeover || type != TransactionInfo.TXN_CLUSTER ||
translist.containsKey(id) || !remoteTranslist.containsKey(id)) {
throw new BrokerException(
Globals.getBrokerResources().getKString(
BrokerResources.X_TRANSACTIONID_INUSE, id.toString()),
BrokerResources.X_TRANSACTIONID_INUSE,
(Throwable) null, Status.CONFLICT);
}
}
// If transaction is an XA (has an xid) save it for reverse mapping
if (xid != null && xidTable.containsKey(xid)) {
// Xid already in use
throw new BrokerException(
Globals.getBrokerResources().getKString(
BrokerResources.X_TRANSACTIONID_INUSE,
id.toString() + "[Xid=" + xid.toString() + "]"),
BrokerResources.X_TRANSACTIONID_INUSE,
(Throwable) null,
Status.CONFLICT);
}
} finally {