ARTEMIS-1638 Fixing Purge rollback behaviour (fix)

This commit is contained in:
Clebert Suconic 2018-01-25 21:17:38 -05:00
parent 69429e4e23
commit adb466b2f8
1 changed files with 15 additions and 0 deletions

View File

@ -2896,11 +2896,26 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
void postRollback(final LinkedList<MessageReference> refs) { void postRollback(final LinkedList<MessageReference> refs) {
//if we have purged then ignore adding the messages back //if we have purged then ignore adding the messages back
if (purgeOnNoConsumers && getConsumerCount() == 0) { if (purgeOnNoConsumers && getConsumerCount() == 0) {
purgeAfterRollback(refs);
return; return;
} }
addHead(refs, false); addHead(refs, false);
} }
private void purgeAfterRollback(LinkedList<MessageReference> refs) {
try {
Transaction transaction = new TransactionImpl(storageManager);
for (MessageReference reference : refs) {
incDelivering(); // post ack will decrement this, so need to inc
acknowledge(transaction, reference, AckReason.KILLED);
}
transaction.commit();
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
private long calculateRedeliveryDelay(final AddressSettings addressSettings, final int deliveryCount) { private long calculateRedeliveryDelay(final AddressSettings addressSettings, final int deliveryCount) {
long redeliveryDelay = addressSettings.getRedeliveryDelay(); long redeliveryDelay = addressSettings.getRedeliveryDelay();
long maxRedeliveryDelay = addressSettings.getMaxRedeliveryDelay(); long maxRedeliveryDelay = addressSettings.getMaxRedeliveryDelay();