mirror of https://github.com/apache/activemq.git
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:
parent
2f935a260b
commit
9d545cf11f
|
@ -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
|
//condition if the original add is processed after the update, which can cause
|
||||||
//a duplicate message to be stored
|
//a duplicate message to be stored
|
||||||
if (messages.isCacheEnabled() && !isPersistJMSRedelivered()) {
|
if (messages.isCacheEnabled() && !isPersistJMSRedelivered()) {
|
||||||
message.beforeMarshall(null);
|
message.beforeMarshall(null);
|
||||||
result = store.asyncAddQueueMessage(context, message, isOptimizeStorage());
|
result = store.asyncAddQueueMessage(context, message, isOptimizeStorage());
|
||||||
final PendingMarshalUsageTracker tracker = new PendingMarshalUsageTracker(message);
|
result.addListener(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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
store.addMessage(context, message);
|
store.addMessage(context, message);
|
||||||
if (isReduceMemoryFootprint()) {
|
}
|
||||||
message.clearMarshalledState();
|
if (isReduceMemoryFootprint()) {
|
||||||
}
|
message.clearMarshalledState();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// we may have a store in inconsistent state, so reset the cursor
|
// we may have a store in inconsistent state, so reset the cursor
|
||||||
|
|
Loading…
Reference in New Issue