use of com.sun.messaging.jmq.jmsserver.cluster.api.RemoteTransactionAckEntry in project openmq by eclipse-ee4j.
the class RemoteTxnConverter method convert.
void convert(TransactionInformation txnInfo) throws BrokerException {
if (ToTxnLogConverter.DEBUG) {
logger.log(Logger.DEBUG, getPrefix() + " convert " + txnInfo);
}
// should be a prepared transaction
int state = txnInfo.getState().getState();
if (state != TransactionState.PREPARED) {
String msg = getPrefix() + " convert: unknown state " + state + " for " + txnInfo;
logger.log(Logger.ERROR, msg);
}
TransactionUID txid = txnInfo.getTID();
TransactionState newState = new TransactionState(txnInfo.getState());
RemoteTransactionAckEntry[] rtaes = transactionList.getRecoveryRemoteTransactionAcks(txid);
if (rtaes != null) {
ArrayList<TransactionAcknowledgement> al = new ArrayList<>();
for (int i = 0; i < rtaes.length; i++) {
RemoteTransactionAckEntry rtae = rtaes[i];
TransactionAcknowledgement[] txnAcks = rtae.getAcks();
for (int j = 0; j < txnAcks.length; j++) {
al.add(txnAcks[j]);
}
}
TransactionAcknowledgement[] txnAcks = al.toArray(new TransactionAcknowledgement[al.size()]);
DestinationUID[] destIds = new DestinationUID[txnAcks.length];
for (int i = 0; i < txnAcks.length; i++) {
SysMessageID sid = txnAcks[i].getSysMessageID();
PacketReference p = DL.get((PartitionedStore) store, sid);
DestinationUID destID = null;
if (p != null) {
destID = p.getDestinationUID();
} else {
logger.log(Logger.WARNING, "Could not find packet for " + sid);
}
destIds[i] = destID;
}
TransactionBroker txnBroker = transactionList.getRemoteTransactionHomeBroker(txid);
BrokerAddress txnHomeBroker = txnBroker.getBrokerAddress();
RemoteTransaction remoteTxn = new RemoteTransaction(txid, newState, txnAcks, destIds, txnHomeBroker);
store.logTxn(remoteTxn);
} else {
logger.log(Logger.ERROR, "Could not find RemoteTransactionAckEntry for " + txid);
}
}
Aggregations