Reverting the change to move clearMarshalledState into the callback
listener as beforeMarshall is now called before the async message add

Revert 7f5c09f2d7
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-04-18 11:54:38 +00:00
parent 2f935a260b
commit 9d545cf11f
1 changed files with 5 additions and 19 deletions

View File

@ -840,28 +840,14 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
//condition if the original add is processed after the update, which can cause
//a duplicate message to be stored
if (messages.isCacheEnabled() && !isPersistJMSRedelivered()) {
message.beforeMarshall(null);
message.beforeMarshall(null);
result = store.asyncAddQueueMessage(context, message, isOptimizeStorage());
final PendingMarshalUsageTracker tracker = new PendingMarshalUsageTracker(message);
result.addListener(new Runnable() {
@Override
public void run() {
//Execute usage tracker and then check isReduceMemoryFootprint()
tracker.run();
if (isReduceMemoryFootprint()) {
try {
message.clearMarshalledState();
} catch (JMSException e) {
throw new IllegalStateException(e);
}
}
}
});
result.addListener(new PendingMarshalUsageTracker(message));
} else {
store.addMessage(context, message);
if (isReduceMemoryFootprint()) {
message.clearMarshalledState();
}
}
if (isReduceMemoryFootprint()) {
message.clearMarshalledState();
}
} catch (Exception e) {
// we may have a store in inconsistent state, so reset the cursor