*/
public void storeRemoteTransaction(TransactionUID id, TransactionState ts,
TransactionAcknowledgement[] acks, BrokerAddress txnHomeBroker,
boolean sync) throws BrokerException {
TransactionInfo txnInfo = null;
boolean removedAcksFlag = false;
try {
if (tidMap.containsKey(id)) {
logger.log(Logger.ERROR,
BrokerResources.E_TRANSACTIONID_EXISTS_IN_STORE, id);
throw new BrokerException(br.getString(
BrokerResources.E_TRANSACTIONID_EXISTS_IN_STORE, id));
}
// We must store the acks first if provided
if (acks != null && acks.length > 0) {
txnAckList.storeAcks(id, acks, sync);
removedAcksFlag = true;
}
// Now we store the txn;
// TransactionState is mutable, so we must store a copy
txnInfo = new TransactionInfo(new TransactionState(ts), txnHomeBroker,
null, TransactionInfo.TXN_REMOTE);
tidMap.put(id, txnInfo);
if (sync) {
sync(id);
}
} catch (RuntimeException e) {
String msg = (txnInfo != null) ?
id + " " + txnInfo.toString() : id.toString();
logger.log(Logger.ERROR,
BrokerResources.X_PERSIST_TRANSACTION_FAILED, msg, e);
try {
if (removedAcksFlag) {