/** * This will be invoked when the server transition to a new server state. * * @param state new server state */ void handle(State state) { if (state == State.ERROR || state == State.SHUTDOWN) { shutdownLatch.countDown(); } }
@Override public void notifyStopping(String threadName, int exitCode) { //正确而又优雅的打日志的写法 LOG.info("Thread {} exits, error code {}", threadName, exitCode); zkServer.setState(State.ERROR); }
@Override public void notifyStopping(String threadName, int exitCode) { LOG.info("Thread {} exits, error code {}", threadName, exitCode); zkServer.setState(State.ERROR); }