/** {@inheritDoc} */ @Override public void close() throws IOException { if (quorumPeer != null) quorumPeer.shutdown(); }
@Before public void establishThreeParticipantOneObserverEnsemble() throws Exception { qb.setUp(true); ct.hostPort = qb.hostPort; ct.setUpAll(); qb.s5.shutdown(); }
LOG.info("Socket has been closed as expected"); peer.shutdown(); cnxManager.halt(); Assert.assertFalse(cnxManager.listener.isAlive());
Assert.assertNotNull(m); peer.shutdown(); cnxManager.halt(); Assert.assertFalse(cnxManager.listener.isAlive());
@Override public synchronized void shutdown() { if (started) { started = false; if (transactionLog != null) { try { transactionLog.close(); } catch (final IOException ioe) { logger.warn("Failed to close Transaction Log", ioe); } } if (connectionFactory != null) { connectionFactory.shutdown(); } if (quorumPeer != null && quorumPeer.isRunning()) { quorumPeer.shutdown(); } if (embeddedZkServer != null && embeddedZkServer.isRunning()) { embeddedZkServer.shutdown(); } if (datadirCleanupManager != null) { datadirCleanupManager.shutdown(); } } }
peer.shutdown();
peer.shutdown();
public void shutdown(int id) { QuorumPeer qp = getPeer(id).peer; try { LOG.info("Shutting down quorum peer " + qp.getName()); qp.shutdown(); Election e = qp.getElectionAlg(); if (e != null) { LOG.info("Shutting down leader election " + qp.getName()); e.shutdown(); } else { LOG.info("No election available to shutdown " + qp.getName()); } LOG.info("Waiting for " + qp.getName() + " to exit thread"); qp.join(30000); if (qp.isAlive()) { Assert.fail("QP failed to shutdown in 30 seconds: " + qp.getName()); } } catch (InterruptedException e) { LOG.debug("QP interrupted: " + qp.getName(), e); } }
public static void shutdown(QuorumPeer qp) { if (qp == null) { return; } try { LOG.info("Shutting down quorum peer " + qp.getName()); qp.shutdown(); Election e = qp.getElectionAlg(); if (e != null) { LOG.info("Shutting down leader election " + qp.getName()); e.shutdown(); } else { LOG.info("No election available to shutdown " + qp.getName()); } LOG.info("Waiting for " + qp.getName() + " to exit thread"); long readTimeout = qp.getTickTime() * qp.getInitLimit(); long connectTimeout = qp.getTickTime() * qp.getSyncLimit(); long maxTimeout = Math.max(readTimeout, connectTimeout); maxTimeout = Math.max(maxTimeout, ClientBase.CONNECTION_TIMEOUT); qp.join(maxTimeout * 2); if (qp.isAlive()) { Assert.fail("QP failed to shutdown in " + (maxTimeout * 2) + " seconds: " + qp.getName()); } } catch (InterruptedException e) { LOG.debug("QP interrupted: " + qp.getName(), e); } }
/** * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2). * When all but the leader and one observer are shut down, the leader should * enter the 'looking' state, not stay in the 'leading' state. */ @Test public void testLEWithObserver() throws Exception { QuorumPeer leader = null; for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) { if (server.getServerState().equals( QuorumStats.Provider.FOLLOWING_STATE)) { server.shutdown(); assertTrue("Waiting for server down", ClientBase .waitForServerDown("127.0.0.1:" + server.getClientPort(), ClientBase.CONNECTION_TIMEOUT)); } else { assertNull("More than one leader found", leader); leader = server; } } assertTrue("Leader is not in Looking state", ClientBase .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT, QuorumStats.Provider.LOOKING_STATE)); }
peer = peerList.get(id); if (peer != null) { peer.shutdown();
peer = peerList.get(id); if (peer != null) { peer.shutdown();
leader.shutdown();
@Override public void close() throws IOException { if ( quorumPeer != null ) { quorumPeer.shutdown(); } }
@Override public void destroy() throws Exception { peer.shutdown(); peer.join(); }
@Override public void destroy() throws Exception { peer.shutdown(); peer.join(); }
@Override public void shutdown() { // Close the network stack first so that the shutdown process is done quickly. cnxnFactory.shutdown(); purgeManager.shutdown(); super.shutdown(); }
@Override public void shutdown() { // Close the network stack first so that the shutdown process is done quickly. cnxnFactory.shutdown(); purgeManager.shutdown(); super.shutdown(); }