/** * the main method called by the observer to observe the leader * * @throws InterruptedException */ void observeLeader() throws InterruptedException { zk.registerJMX(new ObserverBean(this, zk), self.jmxLocalPeerBean); try { InetSocketAddress addr = findLeader(); LOG.info("Observing " + addr); try { connectToLeader(addr); long newLeaderZxid = registerWithLeader(Leader.OBSERVERINFO); syncWithLeader(newLeaderZxid); QuorumPacket qp = new QuorumPacket(); while (this.isRunning()) { readPacket(qp); processPacket(qp); } } catch (Exception e) { LOG.warn("Exception when observing the leader", e); try { sock.close(); } catch (IOException e1) { e1.printStackTrace(); } // clear pending revalidations pendingRevalidations.clear(); } } finally { zk.unregisterJMX(this); } }
/** * the main method called by the observer to observe the leader * @throws Exception */ void observeLeader() throws Exception { zk.registerJMX(new ObserverBean(this, zk), self.jmxLocalPeerBean); try { InetSocketAddress addr = findLeader(); LOG.info("Observing " + addr); try { connectToLeader(addr); long newLeaderZxid = registerWithLeader(Leader.OBSERVERINFO); if (self.isReconfigStateChange()) throw new Exception("learned about role change"); syncWithLeader(newLeaderZxid); QuorumPacket qp = new QuorumPacket(); while (this.isRunning()) { readPacket(qp); processPacket(qp); } } catch (Exception e) { LOG.warn("Exception when observing the leader", e); try { sock.close(); } catch (IOException e1) { e1.printStackTrace(); } // clear pending revalidations pendingRevalidations.clear(); } } finally { zk.unregisterJMX(this); } }
/** * the main method called by the observer to observe the leader * * @throws InterruptedException */ void observeLeader() throws InterruptedException { zk.registerJMX(new ObserverBean(this, zk), self.jmxLocalPeerBean); try { QuorumServer leaderServer = findLeader(); LOG.info("Observing " + leaderServer.addr); try { connectToLeader(leaderServer.addr, leaderServer.hostname); long newLeaderZxid = registerWithLeader(Leader.OBSERVERINFO); syncWithLeader(newLeaderZxid); QuorumPacket qp = new QuorumPacket(); while (this.isRunning()) { readPacket(qp); processPacket(qp); } } catch (Exception e) { LOG.warn("Exception when observing the leader", e); try { sock.close(); } catch (IOException e1) { e1.printStackTrace(); } // clear pending revalidations pendingRevalidations.clear(); } } finally { zk.unregisterJMX(this); } }
/** * the main method called by the observer to observe the leader * * @throws InterruptedException */ void observeLeader() throws InterruptedException { zk.registerJMX(new ObserverBean(this, zk), self.jmxLocalPeerBean); try { InetSocketAddress addr = findLeader(); LOG.info("Observing " + addr); try { connectToLeader(addr); long newLeaderZxid = registerWithLeader(Leader.OBSERVERINFO); syncWithLeader(newLeaderZxid); QuorumPacket qp = new QuorumPacket(); while (self.isRunning()) { readPacket(qp); processPacket(qp); } } catch (IOException e) { LOG.warn("Exception when observing the leader", e); try { sock.close(); } catch (IOException e1) { e1.printStackTrace(); } // clear pending revalidations pendingRevalidations.clear(); } } finally { zk.unregisterJMX(this); } }
/** * the main method called by the observer to observe the leader * * @throws InterruptedException */ void observeLeader() throws InterruptedException { zk.registerJMX(new ObserverBean(this, zk), self.jmxLocalPeerBean); try { InetSocketAddress addr = findLeader(); LOG.info("Observing " + addr); try { connectToLeader(addr); long newLeaderZxid = registerWithLeader(Leader.OBSERVERINFO); syncWithLeader(newLeaderZxid); QuorumPacket qp = new QuorumPacket(); while (self.isRunning()) { readPacket(qp); processPacket(qp); } } catch (Exception e) { LOG.warn("Exception when observing the leader", e); try { sock.close(); } catch (IOException e1) { e1.printStackTrace(); } // clear pending revalidations pendingRevalidations.clear(); } } finally { zk.unregisterJMX(this); } }
/** * the main method called by the observer to observe the leader * @throws Exception */ void observeLeader() throws Exception { zk.registerJMX(new ObserverBean(this, zk), self.jmxLocalPeerBean); try { InetSocketAddress addr = findLeader(); LOG.info("Observing " + addr); try { connectToLeader(addr); long newLeaderZxid = registerWithLeader(Leader.OBSERVERINFO); if (self.isReconfigStateChange()) throw new Exception("learned about role change"); syncWithLeader(newLeaderZxid); QuorumPacket qp = new QuorumPacket(); while (self.isRunning()) { readPacket(qp); processPacket(qp); } } catch (Exception e) { LOG.warn("Exception when observing the leader", e); try { sock.close(); } catch (IOException e1) { e1.printStackTrace(); } // clear pending revalidations pendingRevalidations.clear(); } } finally { zk.unregisterJMX(this); } }
/** * the main method called by the observer to observe the leader * * @throws InterruptedException */ void observeLeader() throws InterruptedException { zk.registerJMX(new ObserverBean(this, zk), self.jmxLocalPeerBean); try { InetSocketAddress addr = findLeader(); LOG.info("Observing " + addr); try { connectToLeader(addr); long newLeaderZxid = registerWithLeader(Leader.OBSERVERINFO); syncWithLeader(newLeaderZxid); QuorumPacket qp = new QuorumPacket(); while (self.isRunning()) { readPacket(qp); processPacket(qp); } } catch (IOException e) { LOG.warn("Exception when observing the leader", e); try { sock.close(); } catch (IOException e1) { e1.printStackTrace(); } synchronized (pendingRevalidations) { // clear pending revalidations pendingRevalidations.clear(); pendingRevalidations.notifyAll(); } } } finally { zk.unregisterJMX(this); } }