@Override public void initialize() throws DurableDataLogException { Preconditions.checkState(this.bookKeeper.get() == null, "BookKeeperLogFactory is already initialized."); try { this.bookKeeper.set(startBookKeeperClient()); } catch (IllegalArgumentException | NullPointerException ex) { // Most likely a configuration issue; re-throw as is. close(); throw ex; } catch (Throwable ex) { if (!Exceptions.mustRethrow(ex)) { // Make sure we close anything we may have opened. close(); } // ZooKeeper not reachable, some other environment issue. throw new DataLogNotAvailableException("Unable to establish connection to ZooKeeper or BookKeeper.", ex); } }