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

Revert 75990ef14a
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-04-18 11:49:16 +00:00
parent c8af70f094
commit 9c8bd3360f
1 changed files with 4 additions and 18 deletions

View File

@ -840,26 +840,12 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
if (messages.isCacheEnabled() && !isPersistJMSRedelivered()) {
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