public static BabySitter nonblockingFactory ( ZooKeeper zk , String dir , Callback cb , ExecutorService es ) throws InterruptedException , ExecutionException { BabySitter bs = new BabySitter ( zk , dir , cb , es ) ; bs . m_es . submit ( bs . m_eventHandler ) ; return bs ; }
Create a new BabySitter and make sure it reads the initial children list . Use the provided ExecutorService to queue events to rather than creating a private ExecutorService .