/** * Close resources like zookeeper, thread pool */ protected void close() throws InterruptedException { if(this.zkHeartBeatEnabled) { stopHeartBeat(); } if(getZooKeeper() != null) { getZooKeeper().close(); } // shut down thread pool this.threadPool.shutdownNow(); this.threadPool.awaitTermination(2, TimeUnit.SECONDS); }