it's possible to get an NPE here on shutdown in tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1175656 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2011-09-26 04:13:38 +00:00
parent 44b56415a8
commit 68d098fbef
1 changed files with 5 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import org.apache.solr.SolrTestCaseJ4;
import org.apache.zookeeper.jmx.ManagedUtil;
import org.apache.zookeeper.server.NIOServerCnxn;
import org.apache.zookeeper.server.ServerConfig;
import org.apache.zookeeper.server.ZKDatabase;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.apache.zookeeper.server.SessionTracker.Session;
import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
@ -108,7 +109,10 @@ public class ZkTestServer {
*/
protected void shutdown() throws IOException {
zooKeeperServer.shutdown();
zooKeeperServer.getZKDatabase().close();
ZKDatabase zkDb = zooKeeperServer.getZKDatabase();
if (zkDb != null) {
zkDb.close();
}
waitForServerDown(getZkHost() + ":" + getPort(), 5000);
cnxnFactory.shutdown();
}