* @exception NullPointerException if <code>id</code> is <code>null</code>
*/
public void storeClusterTransaction(TransactionUID id, TransactionState ts,
TransactionBroker[] brokers, boolean sync) throws BrokerException {
TransactionInfo txnInfo = null;
try {
// TransactionState is mutable, so we must store a copy
// See bug 4989708
txnInfo = new TransactionInfo(new TransactionState(ts), null,
brokers, TransactionInfo.TXN_CLUSTER);
Object oldValue = tidMap.putIfAbsent(id, txnInfo);
if (oldValue != null) {
logger.log(Logger.ERROR,
BrokerResources.E_TRANSACTIONID_EXISTS_IN_STORE, id);
throw new BrokerException(br.getString(
BrokerResources.E_TRANSACTIONID_EXISTS_IN_STORE, id));
}
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);
throw new BrokerException(br.getString(
BrokerResources.X_PERSIST_TRANSACTION_FAILED, msg), e);
}