mirror of https://github.com/apache/activemq.git
Fix problem in message state tracker that will result on OME
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@635565 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5e747b070d
commit
c42c5ff976
|
@ -63,7 +63,9 @@ public class ConnectionStateTracker extends CommandVisitorAdapter {
|
||||||
private Map<MessageId,Message> messageCache = new LinkedHashMap<MessageId,Message>(){
|
private Map<MessageId,Message> messageCache = new LinkedHashMap<MessageId,Message>(){
|
||||||
protected boolean removeEldestEntry(Map.Entry<MessageId,Message> eldest) {
|
protected boolean removeEldestEntry(Map.Entry<MessageId,Message> eldest) {
|
||||||
boolean result = currentCacheSize > maxCacheSize;
|
boolean result = currentCacheSize > maxCacheSize;
|
||||||
currentCacheSize -= eldest.getValue().getSize();
|
if (result) {
|
||||||
|
currentCacheSize -= eldest.getValue().getSize();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -104,7 +106,7 @@ public class ConnectionStateTracker extends CommandVisitorAdapter {
|
||||||
if (trackMessages && command != null && command.isMessage()) {
|
if (trackMessages && command != null && command.isMessage()) {
|
||||||
Message message = (Message) command;
|
Message message = (Message) command;
|
||||||
if (message.getTransactionId()==null) {
|
if (message.getTransactionId()==null) {
|
||||||
currentCacheSize+=message.getSize();
|
currentCacheSize = currentCacheSize + message.getSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue