diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java index a2d3914a52..9b44f9df81 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.broker.region; +import java.io.IOException; import org.apache.activemq.broker.Broker; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.ConnectionContext; @@ -363,5 +364,10 @@ public abstract class BaseDestination implements Destination { broker.isFull(context,this, usage); } } + + public void dispose(ConnectionContext context) throws IOException { + destinationStatistics.setParent(null); + this.memoryUsage.stop(); + } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java index 247b674e96..ba043f780a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java @@ -479,10 +479,10 @@ public class Queue extends BaseDestination implements Task { } public void dispose(ConnectionContext context) throws IOException { + super.dispose(context); if (store != null) { store.removeAllMessages(context); } - destinationStatistics.setParent(null); } public void gc(){ diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java index a94f0e7edf..893fad3358 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java @@ -453,10 +453,10 @@ public class Topic extends BaseDestination implements Task{ } public void dispose(ConnectionContext context) throws IOException { + super.dispose(context); if (topicStore != null) { topicStore.removeAllMessages(context); } - destinationStatistics.setParent(null); } public void gc() {