use of com.swiftmq.amqp.v100.generated.transactions.coordination.TransactionId in project swiftmq-ce by iitsoftware.
the class TransactionRegistry method addToTransaction.
public void addToTransaction(TxnIdIF btxnId, SourceLink sourceLink, long deliveryId, MessageIndex messageIndex, long size) throws EndWithErrorException {
String txnId = new String(((TransactionId) btxnId).getValue());
String linkName = sourceLink.getName();
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + "/addToTransaction, txnId=" + txnId + ", linkName=" + linkName + ", messageIndex=" + messageIndex);
lock.lock();
try {
ActiveTxEntry activeTxEntry = (ActiveTxEntry) activeTx.get(txnId);
if (activeTxEntry == null) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + "/addToTransaction, txnId=" + txnId + ", not found!");
throw new SessionEndException(TransactionError.UNKNOWN_ID, new AMQPString("Transaction id not found: " + txnId));
}
sourceLink.increaseActiveTransactions();
if (activeTxEntry.outboundTxEntryMap == null)
activeTxEntry.outboundTxEntryMap = new HashMap();
OutboundTxEntry outboundTxEntry = (OutboundTxEntry) activeTxEntry.outboundTxEntryMap.get(deliveryId);
if (outboundTxEntry == null) {
outboundTxEntry = new OutboundTxEntry(sourceLink, messageIndex, null);
activeTxEntry.outboundTxEntryMap.put(deliveryId, outboundTxEntry);
} else {
outboundTxEntry.sourceLink = sourceLink;
outboundTxEntry.messageIndex = messageIndex;
}
} finally {
lock.unlock();
}
}
Aggregations