mirror of https://github.com/apache/activemq.git
replicated leveldb test improvements
This commit is contained in:
parent
c266b1069b
commit
5315389080
|
@ -277,9 +277,14 @@ class ElectingLevelDBStore extends ProxyLevelDBStore {
|
|||
if(brokerService!=null && brokerService.isUseJmx){
|
||||
brokerService.getManagementContext().unregisterMBean(objectName);
|
||||
}
|
||||
zk_group.close
|
||||
zk_client.close()
|
||||
zk_client = null
|
||||
if (zk_group != null) {
|
||||
zk_group.close
|
||||
zk_group = null
|
||||
}
|
||||
if (zk_client != null) {
|
||||
zk_client.close()
|
||||
zk_client = null
|
||||
}
|
||||
|
||||
if( master!=null ) {
|
||||
val latch = new CountDownLatch(1)
|
||||
|
|
|
@ -83,13 +83,6 @@ public class ReplicatedLevelDBBrokerTest extends ZooKeeperTestSupport {
|
|||
deleteDirectory("node-3");
|
||||
}
|
||||
|
||||
protected void deleteDirectory(String s) throws IOException {
|
||||
try {
|
||||
FileUtils.deleteDirectory(new File(data_dir(), s));
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public interface Client{
|
||||
public void execute(Connection connection) throws Exception;
|
||||
}
|
||||
|
@ -284,6 +277,7 @@ public class ReplicatedLevelDBBrokerTest extends ZooKeeperTestSupport {
|
|||
System.out.println("======================================");
|
||||
System.out.println("5. Restart the stopped node & 6. stop current master");
|
||||
System.out.println("======================================");
|
||||
brokers.remove(prevMaster);
|
||||
prevMaster = createBrokerNode(prevMaster.getBrokerName());
|
||||
startBrokerAsync(prevMaster);
|
||||
stop(master);
|
||||
|
@ -411,6 +405,7 @@ public class ReplicatedLevelDBBrokerTest extends ZooKeeperTestSupport {
|
|||
}
|
||||
}
|
||||
brokers.clear();
|
||||
resetDataDirs();
|
||||
}
|
||||
|
||||
private BrokerService createBrokerNode(String id) throws Exception {
|
||||
|
|
|
@ -18,13 +18,12 @@ package org.apache.activemq.leveldb.test;
|
|||
|
||||
import org.apache.activemq.leveldb.CountDownFuture;
|
||||
import org.apache.activemq.leveldb.util.FileSupport;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.zookeeper.server.NIOServerCnxnFactory;
|
||||
import org.apache.zookeeper.server.ZooKeeperServer;
|
||||
import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
|
@ -62,6 +61,8 @@ public class ZooKeeperTestSupport {
|
|||
connector.shutdown();
|
||||
connector = null;
|
||||
}
|
||||
deleteDirectory("zk-log");
|
||||
deleteDirectory("zk-data");
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,4 +109,11 @@ public class ZooKeeperTestSupport {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void deleteDirectory(String s) throws java.io.IOException {
|
||||
try {
|
||||
FileUtils.deleteDirectory(new File(data_dir(), s));
|
||||
} catch (java.io.IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue