https://issues.apache.org/jira/browse/AMQ-2852 - Memory leak when undeploying webapp with ActiveMQ client - AMQ store piece

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1084633 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-03-23 16:36:55 +00:00
parent 4552896e91
commit c42d8de034
3 changed files with 11 additions and 10 deletions

View File

@ -2231,7 +2231,7 @@ public class BrokerService implements Service {
return this.executor;
}
protected synchronized Scheduler getScheduler() {
public synchronized Scheduler getScheduler() {
if (this.scheduler==null) {
this.scheduler = new Scheduler("ActiveMQ Broker["+getBrokerName()+"] Scheduler");
try {

View File

@ -174,11 +174,13 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
}
if (this.brokerService != null) {
this.taskRunnerFactory = this.brokerService.getTaskRunnerFactory();
}else {
this.scheduler = this.brokerService.getScheduler();
} else {
this.taskRunnerFactory = new TaskRunnerFactory("AMQPersistenceAdaptor Task", getJournalThreadPriority(),
true, 1000, isUseDedicatedTaskRunner());
this.scheduler = new Scheduler("AMQPersistenceAdapter Scheduler");
}
this.taskRunnerFactory= new TaskRunnerFactory("AMQPersistenceAdaptor Task", getJournalThreadPriority(),
true, 1000, isUseDedicatedTaskRunner());
IOHelper.mkdirs(this.directory);
lockFile = new RandomAccessFile(new File(directory, "lock"), "rw");
lock();
@ -201,10 +203,6 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
referenceStoreAdapter.setUsageManager(usageManager);
referenceStoreAdapter.setMaxDataFileLength(getMaxReferenceFileLength());
if (brokerService != null) {
this.scheduler = this.brokerService.getBroker().getScheduler();
}
if (failIfJournalIsLocked) {
asyncDataManager.lock();
} else {
@ -336,6 +334,11 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
IOException firstException = null;
referenceStoreAdapter.stop();
referenceStoreAdapter = null;
if (this.brokerService == null) {
this.taskRunnerFactory.shutdown();
this.scheduler.stop();
}
try {
LOG.debug("Journal close");
asyncDataManager.close();

View File

@ -333,8 +333,6 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve
/**
* When we checkpoint we move all the journalled data to long term storage.
*
* @param stopping
* @param b
*/
public void checkpoint(boolean sync, boolean fullCheckpoint) {
try {