mirror of
https://github.com/apache/activemq.git
synced 2025-02-09 03:25:33 +00:00
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){
|
if(brokerService!=null && brokerService.isUseJmx){
|
||||||
brokerService.getManagementContext().unregisterMBean(objectName);
|
brokerService.getManagementContext().unregisterMBean(objectName);
|
||||||
}
|
}
|
||||||
|
if (zk_group != null) {
|
||||||
zk_group.close
|
zk_group.close
|
||||||
|
zk_group = null
|
||||||
|
}
|
||||||
|
if (zk_client != null) {
|
||||||
zk_client.close()
|
zk_client.close()
|
||||||
zk_client = null
|
zk_client = null
|
||||||
|
}
|
||||||
|
|
||||||
if( master!=null ) {
|
if( master!=null ) {
|
||||||
val latch = new CountDownLatch(1)
|
val latch = new CountDownLatch(1)
|
||||||
|
@ -83,13 +83,6 @@ public class ReplicatedLevelDBBrokerTest extends ZooKeeperTestSupport {
|
|||||||
deleteDirectory("node-3");
|
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 interface Client{
|
||||||
public void execute(Connection connection) throws Exception;
|
public void execute(Connection connection) throws Exception;
|
||||||
}
|
}
|
||||||
@ -284,6 +277,7 @@ public class ReplicatedLevelDBBrokerTest extends ZooKeeperTestSupport {
|
|||||||
System.out.println("======================================");
|
System.out.println("======================================");
|
||||||
System.out.println("5. Restart the stopped node & 6. stop current master");
|
System.out.println("5. Restart the stopped node & 6. stop current master");
|
||||||
System.out.println("======================================");
|
System.out.println("======================================");
|
||||||
|
brokers.remove(prevMaster);
|
||||||
prevMaster = createBrokerNode(prevMaster.getBrokerName());
|
prevMaster = createBrokerNode(prevMaster.getBrokerName());
|
||||||
startBrokerAsync(prevMaster);
|
startBrokerAsync(prevMaster);
|
||||||
stop(master);
|
stop(master);
|
||||||
@ -411,6 +405,7 @@ public class ReplicatedLevelDBBrokerTest extends ZooKeeperTestSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
brokers.clear();
|
brokers.clear();
|
||||||
|
resetDataDirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BrokerService createBrokerNode(String id) throws Exception {
|
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.CountDownFuture;
|
||||||
import org.apache.activemq.leveldb.util.FileSupport;
|
import org.apache.activemq.leveldb.util.FileSupport;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.zookeeper.server.NIOServerCnxnFactory;
|
import org.apache.zookeeper.server.NIOServerCnxnFactory;
|
||||||
import org.apache.zookeeper.server.ZooKeeperServer;
|
import org.apache.zookeeper.server.ZooKeeperServer;
|
||||||
import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
|
import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
@ -62,6 +61,8 @@ public class ZooKeeperTestSupport {
|
|||||||
connector.shutdown();
|
connector.shutdown();
|
||||||
connector = null;
|
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…
x
Reference in New Issue
Block a user