{
transactionId = ((TransactionalState)xfrState).getTxnId();
}
}
ServerTransaction transaction = null;
if(transactionId != null)
{
transaction = getSession().getTransaction(transactionId);
}
else
{
Session_1_0 session = getSession();
transaction = session != null ? session.getTransaction(null) : new AutoCommitTransaction(_vhost.getMessageStore());
}
Outcome outcome = _destination.send(message, transaction);
DeliveryState resultantState;
if(transactionId == null)
{
resultantState = (DeliveryState) outcome;
}
else
{
TransactionalState transactionalState = new TransactionalState();
transactionalState.setOutcome(outcome);
transactionalState.setTxnId(transactionId);
resultantState = transactionalState;
}
boolean settled = transaction instanceof AutoCommitTransaction && ReceiverSettleMode.FIRST.equals(getReceivingSettlementMode());
final Binary deliveryTag = xfr.getDeliveryTag();
if(!settled)
{
_unsettledMap.put(deliveryTag, outcome);
}
getEndpoint().updateDisposition(deliveryTag, resultantState, settled);
getSession().getConnectionModel().registerMessageReceived(message.getSize(), message.getArrivalTime());
if(!(transaction instanceof AutoCommitTransaction))
{
ServerTransaction.Action a;
transaction.addPostTransactionAction(new ServerTransaction.Action()
{
public void postCommit()
{
getEndpoint().updateDisposition(deliveryTag, null, true);
}