{
// nothing to be done
return;
}
final ServerMessage message = ref.getMessage();
boolean durableRef = message.isDurable() && queue.durable;
if (durableRef)
{
int count = message.decrementDurableRefCount();
if (count == 0)
{
// Note - we MUST store the delete after the preceeding ack has been committed to storage, we cannot combine
// the last ack and delete into a single delete.
// This is because otherwise we could have a situation where the same message is being acked concurrently
// from two different queues on different sessions.
// One decrements the ref count, then the other stores a delete, the delete gets committed, but the first
// ack isn't committed, then the server crashes and on
// recovery the message is deleted even though the other ack never committed
// also note then when this happens as part of a trasaction its the tx commt of the ack that is important
// not this
// Also note that this delete shouldn't sync to disk, or else we would build up the executor's queue
// as we can't delete each messaging with sync=true while adding messages transactionally.
// There is a startup check to remove non referenced messages case these deletes fail
try
{
storageManager.deleteMessage(message.getMessageID());
}
catch (Exception e)
{
QueueImpl.log.warn("Unable to remove message id = " + message.getMessageID() + " please remove manually",
e);
}
}
}
try
{
message.decrementRefCount();
}
catch (Exception e)
{
QueueImpl.log.warn("Unable to decrement reference counting", e);
}