@Test public void testReleaseAndTryRemoveAll() throws Exception { LongStateStorage stateHandleProvider = new LongStateStorage(); ZooKeeperStateHandleStore<Long> store = new ZooKeeperStateHandleStore<>( ZOOKEEPER.getClient(), stateHandleProvider); final String pathInZooKeeper = "/testDiscardAll"; final Set<Long> expected = new HashSet<>(); expected.add(311222268470898L); expected.add(132812888L); expected.add(27255442L); expected.add(11122233124L); for (long val : expected) { store.addAndLock(pathInZooKeeper + val, val); } store.releaseAndTryRemoveAll(); assertEquals(0, ZOOKEEPER.getClient().getChildren().forPath("/").size()); }
public void releaseAndTryRemoveAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child : children) { try { releaseAndTryRemove('/' + child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release and try removing all state nodes.", exception); } }
ZooKeeperStateHandleStore { public void releaseAndTryRemoveAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child : children) { try { releaseAndTryRemove('/' + child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release and try removing all state nodes.", exception); } } }
ZooKeeperStateHandleStore { public void releaseAndTryRemoveAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child : children) { try { releaseAndTryRemove('/' + child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release and try removing all state nodes.", exception); } } ZooKeeperStateHandleStore(
		CuratorFramework client,
		RetrievableStateStorageHelper<T> storage); }
ZooKeeperStateHandleStore { public void releaseAndTryRemoveAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child : children) { try { releaseAndTryRemove('/' + child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release and try removing all state nodes.", exception); } } ZooKeeperStateHandleStore(
		CuratorFramework client,
		RetrievableStateStorageHelper<T> storage); RetrievableStateHandle<T> addAndLock(
			String pathInZooKeeper,
			T state); void replace(String pathInZooKeeper, int expectedVersion, T state); int exists(String pathInZooKeeper); RetrievableStateHandle<T> getAndLock(String pathInZooKeeper); Collection<String> getAllPaths(); @SuppressWarnings("unchecked") List<Tuple2<RetrievableStateHandle<T>, String>> getAllAndLock(); @Nullable boolean releaseAndTryRemove(String pathInZooKeeper); void releaseAndTryRemoveAll(); void release(String pathInZooKeeper); void releaseAll(); void deleteChildren(); }
ZooKeeperStateHandleStore { public void releaseAndTryRemoveAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child : children) { try { releaseAndTryRemove('/' + child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release and try removing all state nodes.", exception); } } ZooKeeperStateHandleStore(
		CuratorFramework client,
		RetrievableStateStorageHelper<T> storage); RetrievableStateHandle<T> addAndLock(
			String pathInZooKeeper,
			T state); void replace(String pathInZooKeeper, int expectedVersion, T state); int exists(String pathInZooKeeper); RetrievableStateHandle<T> getAndLock(String pathInZooKeeper); Collection<String> getAllPaths(); @SuppressWarnings("unchecked") List<Tuple2<RetrievableStateHandle<T>, String>> getAllAndLock(); @Nullable boolean releaseAndTryRemove(String pathInZooKeeper); void releaseAndTryRemoveAll(); void release(String pathInZooKeeper); void releaseAll(); void deleteChildren();  }