@Test public void testStandalone() throws Exception { ClientBase.setupTestEnv(); final int CLIENT_PORT = PortAssignment.unique(); MainThread main = new MainThread(CLIENT_PORT, true, null); main.start(); Assert.assertTrue("waiting for server being up", ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT, CONNECTION_TIMEOUT)); clientConnected = new CountDownLatch(1); ZooKeeper zk = new ZooKeeper("127.0.0.1:" + CLIENT_PORT, ClientBase.CONNECTION_TIMEOUT, this); Assert.assertTrue("Failed to establish zkclient connection!", clientConnected.await(CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS)); zk.create("/foo", "foobar".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); Assert.assertEquals(new String(zk.getData("/foo", null, null)), "foobar"); zk.close(); main.shutdown(); main.join(); main.deleteDirs(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT, ClientBase.CONNECTION_TIMEOUT)); }
protected void shutdown() { if (containerManager != null) { containerManager.stop(); } if (cnxnFactory != null) { cnxnFactory.shutdown(); } if (secureCnxnFactory != null) { secureCnxnFactory.shutdown(); } try { if (adminServer != null) { adminServer.shutdown(); } } catch (AdminServerException e) { LOG.warn("Problem stopping AdminServer", e); } }
ZooKeeperServerMain { protected void shutdown() { if (containerManager != null) { containerManager.stop(); } if (cnxnFactory != null) { cnxnFactory.shutdown(); } if (secureCnxnFactory != null) { secureCnxnFactory.shutdown(); } try { if (adminServer != null) { adminServer.shutdown(); } } catch (AdminServerException e) { LOG.warn("Problem stopping AdminServer", e); } } }
ZooKeeperServerMain { protected void shutdown() { if (containerManager != null) { containerManager.stop(); } if (cnxnFactory != null) { cnxnFactory.shutdown(); } if (secureCnxnFactory != null) { secureCnxnFactory.shutdown(); } try { if (adminServer != null) { adminServer.shutdown(); } } catch (AdminServerException e) { LOG.warn("Problem stopping AdminServer", e); } }  }
ZooKeeperServerMain { protected void shutdown() { if (containerManager != null) { containerManager.stop(); } if (cnxnFactory != null) { cnxnFactory.shutdown(); } if (secureCnxnFactory != null) { secureCnxnFactory.shutdown(); } try { if (adminServer != null) { adminServer.shutdown(); } } catch (AdminServerException e) { LOG.warn("Problem stopping AdminServer", e); } }  static void main(String[] args); void runFromConfig(ServerConfig config); }
ZooKeeperServerMain { protected void shutdown() { if (containerManager != null) { containerManager.stop(); } if (cnxnFactory != null) { cnxnFactory.shutdown(); } if (secureCnxnFactory != null) { secureCnxnFactory.shutdown(); } try { if (adminServer != null) { adminServer.shutdown(); } } catch (AdminServerException e) { LOG.warn("Problem stopping AdminServer", e); } }  static void main(String[] args); void runFromConfig(ServerConfig config);  }