ARTEMIS-1638 Fixing Purge rollback behaviour (fix)
This commit is contained in:
parent
69429e4e23
commit
adb466b2f8
|
@ -2896,11 +2896,26 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
void postRollback(final LinkedList<MessageReference> refs) {
|
||||
//if we have purged then ignore adding the messages back
|
||||
if (purgeOnNoConsumers && getConsumerCount() == 0) {
|
||||
purgeAfterRollback(refs);
|
||||
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
long redeliveryDelay = addressSettings.getRedeliveryDelay();
|
||||
long maxRedeliveryDelay = addressSettings.getMaxRedeliveryDelay();
|
||||
|
|
Loading…
Reference in New Issue