/** Deletes the given ZK path recursively and create the path again. */ private ListenableFuture<String> deleteAndCreate( final String path, final byte[] data, final CreateMode mode) { return Futures.transform( ZKOperations.ignoreError( ZKOperations.recursiveDelete(zkClient, path), KeeperException.NoNodeException.class, null), new AsyncFunction<String, String>() { @Override public ListenableFuture<String> apply(String input) throws Exception { return zkClient.create(path, data, mode); } }, Threads.SAME_THREAD_EXECUTOR); }