{
final AMQQueue queue = _virtualHost.getQueue(record.getQueue().getId());
if(queue != null)
{
final long messageId = record.getMessage().getMessageNumber();
final ServerMessage message = _recoveredMessages.get(messageId);
_unusedMessages.remove(messageId);
if(message != null)
{
final MessageReference ref = message.newReference();
branch.enqueue(queue,message);
branch.addPostTransactionAcion(new ServerTransaction.Action()
{
public void postCommit()
{
try
{
queue.enqueue(message, true, null);
ref.release();
}
catch (AMQException e)
{
_logger.error("Unable to enqueue message " + message.getMessageNumber() + " into " +
"queue " + queue.getName() + " (from XA transaction)", e);
throw new RuntimeException(e);
}
}
public void onRollback()
{
ref.release();
}
});
}
else
{
StringBuilder xidString = xidAsString(id);
CurrentActor.get().message(_logSubject,
TransactionLogMessages.XA_INCOMPLETE_MESSAGE(xidString.toString(),
Long.toString(messageId)));
}
}
else
{
StringBuilder xidString = xidAsString(id);
CurrentActor.get().message(_logSubject,
TransactionLogMessages.XA_INCOMPLETE_QUEUE(xidString.toString(),
record.getQueue().getId().toString()));
}
}
for(Transaction.Record record : dequeues)
{
final AMQQueue queue = _virtualHost.getQueue(record.getQueue().getId());
if(queue != null)
{
final long messageId = record.getMessage().getMessageNumber();
final ServerMessage message = _recoveredMessages.get(messageId);
_unusedMessages.remove(messageId);
if(message != null)
{
final QueueEntry entry = queue.getMessageOnTheQueue(messageId);