AMQ-1962 - ensure size is not calculated on stop after store has shutdown

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@701118 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2008-10-02 13:19:08 +00:00
parent b22832e2d8
commit 5d9351846c
2 changed files with 7 additions and 3 deletions

View File

@ -65,8 +65,8 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
public final synchronized void stop() throws Exception { public final synchronized void stop() throws Exception {
getSystemUsage().getMemoryUsage().removeUsageListener(this); getSystemUsage().getMemoryUsage().removeUsageListener(this);
resetBatch(); resetBatch();
gc();
super.stop(); super.stop();
gc();
} }
@ -194,7 +194,11 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
batchList.clear(); batchList.clear();
batchResetNeeded = true; batchResetNeeded = true;
this.cacheEnabled=false; this.cacheEnabled=false;
if (isStarted()) {
size = getStoreSize(); size = getStoreSize();
} else {
size = 0;
}
} }
protected final synchronized void fillBatch() { protected final synchronized void fillBatch() {

View File

@ -77,13 +77,13 @@ public class StoreQueueCursor extends AbstractPendingMessageCursor {
public synchronized void stop() throws Exception { public synchronized void stop() throws Exception {
started = false; started = false;
super.stop();
if (nonPersistent != null) { if (nonPersistent != null) {
nonPersistent.stop(); nonPersistent.stop();
nonPersistent.gc(); nonPersistent.gc();
} }
persistent.stop(); persistent.stop();
persistent.gc(); persistent.gc();
super.stop();
pendingCount = 0; pendingCount = 0;
} }