try and ensure that the brokers shutdown cleanly for the

ReliableReconnectTest - as it can hang

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@603952 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-12-13 16:52:27 +00:00
parent 0ac3f165dc
commit 225d2bf055
3 changed files with 12 additions and 1 deletions

View File

@ -108,6 +108,7 @@ public class KahaStore implements Store {
closed = true;
if (initialized) {
unlock();
lockFile.close();
for (ListContainerImpl container : lists.values()) {
container.close();

View File

@ -253,11 +253,11 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
if (!started.compareAndSet(true, false)) {
return;
}
unlock();
if (lockFile != null) {
lockFile.close();
lockFile = null;
}
unlock();
this.usageManager.getMemoryUsage().removeUsageListener(this);
synchronized (this) {
Scheduler.cancel(periodicCheckpointTask);
@ -890,9 +890,12 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener,
if (!disableLocking && (null != lock)) {
//clear property doesn't work on some platforms
System.getProperties().remove(getPropertyKey());
System.clearProperty(getPropertyKey());
assert(System.getProperty(getPropertyKey())==null);
if (lock.isValid()) {
lock.release();
lock.channel().close();
}
lock = null;
}

View File

@ -68,6 +68,12 @@ public class ReliableReconnectTest extends TestSupport {
topic = true;
destination = createDestination(getClass().getName());
}
protected void tearDown() throws Exception {
if (broker!=null) {
broker.stop();
}
}
public ActiveMQConnectionFactory getConnectionFactory() throws Exception {
String url = "failover://" + DEFAULT_BROKER_URL;
@ -77,6 +83,7 @@ public class ReliableReconnectTest extends TestSupport {
protected void startBroker() throws JMSException {
try {
broker = BrokerFactory.createBroker(new URI("broker://()/localhost"));
broker.setUseShutdownHook(false);
broker.addConnector(DEFAULT_BROKER_URL);
broker.start();
} catch (Exception e) {