@Test public void testDeleteAll() throws Exception { startZK(1); ZookeeperClient client = createClient(SES_TIMEOUT); client.createIfNeeded("/apacheIgnite", null, CreateMode.PERSISTENT); client.createIfNeeded("/apacheIgnite/1", null, CreateMode.PERSISTENT); client.createIfNeeded("/apacheIgnite/2", null, CreateMode.PERSISTENT); client.deleteAll(Arrays.asList("/apacheIgnite/1", "/apacheIgnite/2"), -1); assertTrue(client.getChildren("/apacheIgnite").isEmpty()); client.createIfNeeded("/apacheIgnite/1", null, CreateMode.PERSISTENT); client.deleteAll(Collections.singletonList("/apacheIgnite/1"), -1); assertTrue(client.getChildren("/apacheIgnite").isEmpty()); }
void deleteAll(List<String> paths, int ver) throws ZookeeperClientFailedException, InterruptedException { if (paths.isEmpty()) return; List<List<Op>> batches = new LinkedList<>(); int batchSize = 0; List<Op> batch = new LinkedList<>(); for (String path : paths) { int size = requestOverhead(path) + 17 ; assert size <= MAX_REQ_SIZE; if (batchSize + size > MAX_REQ_SIZE) { batches.add(batch); batch = new LinkedList<>(); batchSize = 0; } batch.add(Op.delete(path, ver)); batchSize += size; } batches.add(batch); for (List<Op> ops : batches) { for (;;) { long connStartTime = this.connStartTime; try { zk.multi(ops); break; } catch (KeeperException.NoNodeException e) { if (log.isDebugEnabled()) log.debug("Failed to delete nodes using bulk operation: " + e); for (Op op : ops) deleteIfExists(op.getPath(), ver); break; } catch (Exception e) { onZookeeperError(connStartTime, e); } } } }
ZookeeperClient implements Watcher { void deleteAll(List<String> paths, int ver) throws ZookeeperClientFailedException, InterruptedException { if (paths.isEmpty()) return; List<List<Op>> batches = new LinkedList<>(); int batchSize = 0; List<Op> batch = new LinkedList<>(); for (String path : paths) { int size = requestOverhead(path) + 17 ; assert size <= MAX_REQ_SIZE; if (batchSize + size > MAX_REQ_SIZE) { batches.add(batch); batch = new LinkedList<>(); batchSize = 0; } batch.add(Op.delete(path, ver)); batchSize += size; } batches.add(batch); for (List<Op> ops : batches) { for (;;) { long connStartTime = this.connStartTime; try { zk.multi(ops); break; } catch (KeeperException.NoNodeException e) { if (log.isDebugEnabled()) log.debug("Failed to delete nodes using bulk operation: " + e); for (Op op : ops) deleteIfExists(op.getPath(), ver); break; } catch (Exception e) { onZookeeperError(connStartTime, e); } } } } }
ZookeeperClient implements Watcher { void deleteAll(List<String> paths, int ver) throws ZookeeperClientFailedException, InterruptedException { if (paths.isEmpty()) return; List<List<Op>> batches = new LinkedList<>(); int batchSize = 0; List<Op> batch = new LinkedList<>(); for (String path : paths) { int size = requestOverhead(path) + 17 ; assert size <= MAX_REQ_SIZE; if (batchSize + size > MAX_REQ_SIZE) { batches.add(batch); batch = new LinkedList<>(); batchSize = 0; } batch.add(Op.delete(path, ver)); batchSize += size; } batches.add(batch); for (List<Op> ops : batches) { for (;;) { long connStartTime = this.connStartTime; try { zk.multi(ops); break; } catch (KeeperException.NoNodeException e) { if (log.isDebugEnabled()) log.debug("Failed to delete nodes using bulk operation: " + e); for (Op op : ops) deleteIfExists(op.getPath(), ver); break; } catch (Exception e) { onZookeeperError(connStartTime, e); } } } } ZookeeperClient(IgniteLogger log, String connectString, int sesTimeout, IgniteRunnable connLostC);   ZookeeperClient(String igniteInstanceName,
        IgniteLogger log,
        String connectString,
        int sesTimeout,
        IgniteRunnable connLostC); }
ZookeeperClient implements Watcher { void deleteAll(List<String> paths, int ver) throws ZookeeperClientFailedException, InterruptedException { if (paths.isEmpty()) return; List<List<Op>> batches = new LinkedList<>(); int batchSize = 0; List<Op> batch = new LinkedList<>(); for (String path : paths) { int size = requestOverhead(path) + 17 ; assert size <= MAX_REQ_SIZE; if (batchSize + size > MAX_REQ_SIZE) { batches.add(batch); batch = new LinkedList<>(); batchSize = 0; } batch.add(Op.delete(path, ver)); batchSize += size; } batches.add(batch); for (List<Op> ops : batches) { for (;;) { long connStartTime = this.connStartTime; try { zk.multi(ops); break; } catch (KeeperException.NoNodeException e) { if (log.isDebugEnabled()) log.debug("Failed to delete nodes using bulk operation: " + e); for (Op op : ops) deleteIfExists(op.getPath(), ver); break; } catch (Exception e) { onZookeeperError(connStartTime, e); } } } } ZookeeperClient(IgniteLogger log, String connectString, int sesTimeout, IgniteRunnable connLostC);   ZookeeperClient(String igniteInstanceName,
        IgniteLogger log,
        String connectString,
        int sesTimeout,
        IgniteRunnable connLostC); @Override void process(WatchedEvent evt); void close(); }
ZookeeperClient implements Watcher { void deleteAll(List<String> paths, int ver) throws ZookeeperClientFailedException, InterruptedException { if (paths.isEmpty()) return; List<List<Op>> batches = new LinkedList<>(); int batchSize = 0; List<Op> batch = new LinkedList<>(); for (String path : paths) { int size = requestOverhead(path) + 17 ; assert size <= MAX_REQ_SIZE; if (batchSize + size > MAX_REQ_SIZE) { batches.add(batch); batch = new LinkedList<>(); batchSize = 0; } batch.add(Op.delete(path, ver)); batchSize += size; } batches.add(batch); for (List<Op> ops : batches) { for (;;) { long connStartTime = this.connStartTime; try { zk.multi(ops); break; } catch (KeeperException.NoNodeException e) { if (log.isDebugEnabled()) log.debug("Failed to delete nodes using bulk operation: " + e); for (Op op : ops) deleteIfExists(op.getPath(), ver); break; } catch (Exception e) { onZookeeperError(connStartTime, e); } } } } ZookeeperClient(IgniteLogger log, String connectString, int sesTimeout, IgniteRunnable connLostC);   ZookeeperClient(String igniteInstanceName,
        IgniteLogger log,
        String connectString,
        int sesTimeout,
        IgniteRunnable connLostC); @Override void process(WatchedEvent evt); void close();  }