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.

(cherry picked from commit b2327db3b7)
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-04-01 16:38:17 +00:00
parent 7f5c09f2d7
commit 8393e6b8ea
1 changed files with 5 additions and 1 deletions

View File

@ -835,7 +835,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() {