Disabling async queue message store when persistJMSRedelivered is turned
on for a destination.  That flag will cause a sync update later on
dispatch which can cause a race condition if the original message add is
processed after the update.  This can cause a duplicate message to be
stored.
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-04-01 16:38:17 +00:00
parent 993d561947
commit b2327db3b7
1 changed files with 5 additions and 1 deletions

View File

@ -833,7 +833,11 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
if (store != null && message.isPersistent()) {
message.getMessageId().setFutureOrSequenceLong(null);
try {
if (messages.isCacheEnabled()) {
//AMQ-6133 - don't store async if using persistJMSRedelivered
//This flag causes a sync update later on dispatch which can cause a race
//condition if the original add is processed after the update, which can cause
//a duplicate message to be stored
if (messages.isCacheEnabled() && !isPersistJMSRedelivered()) {
result = store.asyncAddQueueMessage(context, message, isOptimizeStorage());
final PendingMarshalUsageTracker tracker = new PendingMarshalUsageTracker(message);
result.addListener(new Runnable() {