synchronized public void stop() { listenerRunning = false; if (pinger != null) { pinger.shutdownNow(); } if (ss != null) { try { ss.close(); } catch (IOException e) { e.printStackTrace(); } } for (LearnerHandler lh: activeObservers) { lh.shutdown(); } }
@Override public void terminateConnection() { LOG.info("terminating learner handler connection on demand " + toString()); learnerHandler.shutdown(); }
/** * ping calls from the learnerMaster to the peers */ public void ping() { // If learner hasn't sync properly yet, don't send ping packet // otherwise, the learner will crash if (!sendingThreadStarted) { return; } long id; if (syncLimitCheck.check(System.nanoTime())) { id = learnerMaster.getLastProposed(); QuorumPacket ping = new QuorumPacket(Leader.PING, id, null, null); queuePacket(ping); } else { LOG.warn("Closing connection to peer due to transaction timeout."); shutdown(); } }
LearnerHandler f = it.next(); it.remove(); f.shutdown();
/** * ping calls from the leader to the peers */ public void ping() { long id; if (syncLimitCheck.check(System.nanoTime())) { synchronized(leader) { id = leader.lastProposed; } QuorumPacket ping = new QuorumPacket(Leader.PING, id, null, null); queuePacket(ping); } else { LOG.warn("Closing connection to peer due to transaction timeout."); shutdown(); } }
LearnerHandler f = it.next(); it.remove(); f.shutdown();
LOG.error("LearnerHandler is too far behind ({} < {}), disconnecting {} at {}", Long.toHexString(lastSeenZxid + 1), Long.toHexString(packet.getZxid()), learnerHandler.getSid(), learnerHandler.getRemoteAddress()); learnerHandler.shutdown(); return -1; } else if (packet.getZxid() == lastSeenZxid + 1) {
} finally { LOG.warn("******* GOODBYE {} ********", getRemoteAddress()); shutdown();
+ (sock != null ? sock.getRemoteSocketAddress() : "<null>") + " ********"); shutdown();
LearnerHandler f = it.next(); it.remove(); f.shutdown();
LOG.warn("Ignoring unexpected exception", e); shutdown();