public void shutdown() { shutdown(false); }
public void shutdown() { shutdown(false); }
public void shutdown() { try { // close listen socket and signal selector threads to stop stop(); // wait for selector and worker threads to shutdown join(); // close all open connections closeAll(); if (login != null) { login.shutdown(); } } catch (InterruptedException e) { LOG.warn("Ignoring interrupted exception during shutdown", e); } catch (Exception e) { LOG.warn("Ignoring unexpected exception during shutdown", e); } if (zkServer != null) { zkServer.shutdown(); } }
@Override public synchronized void shutdown() { if (!canShutdown()) { LOG.debug("ZooKeeper server is not running, so not proceeding to shutdown!"); return; } shutdown = true; unregisterJMX(this); // set peer's server to null self.setZooKeeperServer(null); // clear all the connections self.closeAllConnections(); self.adminServer.setZooKeeperServer(null); // shutdown the server itself super.shutdown(); }
zkServer.shutdown();
@After public void teardown() throws Exception { if (servcnxnf != null) { servcnxnf.shutdown(); } if (zks != null) { zks.shutdown(); } }
@Override public void close() throws IOException { if (started.get() && !stopped.getAndSet(true)) { cnxnFactory.shutdown(); try { cnxnFactory.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } if (zkServer.isRunning()) { zkServer.shutdown(); } deleteRecursively(zkDataDir.toPath(), ALLOW_INSECURE); } }
@Override public void shutdown() { LOG.info("shutdown called " + localAddress); if (login != null) { login.shutdown(); } // null if factory never started if (parentChannel != null) { parentChannel.close().awaitUninterruptibly(); closeAll(); allChannels.close().awaitUninterruptibly(); bootstrap.releaseExternalResources(); } if (zkServer != null) { zkServer.shutdown(); } synchronized(this) { killed = true; notifyAll(); } }
@After public void tearDown() throws Exception { serverFactory.shutdown(); zs.shutdown(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown(HOSTPORT, CONNECTION_TIMEOUT)); }
@After public void teardown() throws Exception { // count down to avoid infinite blocking call due to this latch, if // any. startupDelayLatch.countDown(); if (servcnxnf != null) { servcnxnf.shutdown(); } if (zks != null) { zks.shutdown(); } if (zks.getZKDatabase() != null) { zks.getZKDatabase().close(); } ClientBase.recursiveDelete(tmpDir); }
zks.shutdown(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown(HOSTPORT,
/** * ZOOKEEPER-1573: test restoring a snapshot with deleted txns ahead of the * snapshot file's zxid. */ @Test public void testReloadSnapshotWithMissingParent() throws Exception { // create transactions to create the snapshot with create/delete pattern ZooKeeper zk = createZKClient(hostPort); zk.create("/a", "".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); Stat stat = zk.exists("/a", false); long createZxId = stat.getMzxid(); zk.create("/a/b", "".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.delete("/a/b", -1); zk.delete("/a", -1); // force the zxid to be behind the content ZooKeeperServer zks = getServer(serverFactory); zks.getZKDatabase().setlastProcessedZxid(createZxId); LOG.info("Set lastProcessedZxid to {}", zks.getZKDatabase() .getDataTreeLastProcessedZxid()); // Force snapshot and restore zks.takeSnapshot(); zks.shutdown(); stopServer(); startServer(); } }
zk.close(); f.shutdown(); zks.shutdown(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown(HOSTPORT, ClientBase.CONNECTION_TIMEOUT));
zk.close(); f.shutdown(); zks.shutdown(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown(HOSTPORT, ClientBase.CONNECTION_TIMEOUT));
@Test public void testDisconnectedAddAuth() throws Exception { File tmpDir = ClientBase.createTmpDir(); ClientBase.setupTestEnv(); ZooKeeperServer zks = new ZooKeeperServer(tmpDir, tmpDir, 3000); SyncRequestProcessor.setSnapCount(1000); final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]); ServerCnxnFactory f = ServerCnxnFactory.createFactory(PORT, -1); f.startup(zks); try { LOG.info("starting up the zookeeper server .. waiting"); Assert.assertTrue("waiting for server being up", ClientBase.waitForServerUp(HOSTPORT, CONNECTION_TIMEOUT)); ZooKeeper zk = ClientBase.createZKClient(HOSTPORT); try { zk.addAuthInfo("digest", "pat:test".getBytes()); zk.setACL("/", Ids.CREATOR_ALL_ACL, -1); } finally { zk.close(); } } finally { f.shutdown(); zks.shutdown(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown(HOSTPORT, ClientBase.CONNECTION_TIMEOUT)); } }
QuorumTest.CONNECTION_TIMEOUT)); factory.shutdown(); zks.shutdown(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown("127.0.0.1:" + PORT,
zks.shutdown(); f.shutdown(); Assert.assertTrue("waiting for server being down ", ClientBase
zks.shutdown(); stopServer();