@Test public void testRelease() throws Exception { LongStateStorage longStateStorage = new LongStateStorage(); ZooKeeperStateHandleStore<Long> zkStore = new ZooKeeperStateHandleStore<>( ZOOKEEPER.getClient(), longStateStorage); final String path = "/state"; zkStore.addAndLock(path, 42L); final String lockPath = zkStore.getLockPath(path); Stat stat = ZOOKEEPER.getClient().checkExists().forPath(lockPath); assertNotNull("Expected an existing lock", stat); zkStore.release(path); stat = ZOOKEEPER.getClient().checkExists().forPath(path); assertEquals("Expected no lock nodes as children", 0, stat.getNumChildren()); zkStore.releaseAndTryRemove(path); stat = ZOOKEEPER.getClient().checkExists().forPath(path); assertNull("State node should have been removed.",stat); }
public void release(String pathInZooKeeper) throws Exception { final String path = normalizePath(pathInZooKeeper); try { client.delete().forPath(getLockPath(path)); } catch (KeeperException.NoNodeException ignored) { } catch (Exception e) { throw new Exception("Could not release the lock: " + getLockPath(pathInZooKeeper) + '.', e); } }
ZooKeeperStateHandleStore { public void release(String pathInZooKeeper) throws Exception { final String path = normalizePath(pathInZooKeeper); try { client.delete().forPath(getLockPath(path)); } catch (KeeperException.NoNodeException ignored) { } catch (Exception e) { throw new Exception("Could not release the lock: " + getLockPath(pathInZooKeeper) + '.', e); } } }
ZooKeeperStateHandleStore { public void release(String pathInZooKeeper) throws Exception { final String path = normalizePath(pathInZooKeeper); try { client.delete().forPath(getLockPath(path)); } catch (KeeperException.NoNodeException ignored) { } catch (Exception e) { throw new Exception("Could not release the lock: " + getLockPath(pathInZooKeeper) + '.', e); } } ZooKeeperStateHandleStore(
		CuratorFramework client,
		RetrievableStateStorageHelper<T> storage); }
ZooKeeperStateHandleStore { public void release(String pathInZooKeeper) throws Exception { final String path = normalizePath(pathInZooKeeper); try { client.delete().forPath(getLockPath(path)); } catch (KeeperException.NoNodeException ignored) { } catch (Exception e) { throw new Exception("Could not release the lock: " + getLockPath(pathInZooKeeper) + '.', e); } } 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 release(String pathInZooKeeper) throws Exception { final String path = normalizePath(pathInZooKeeper); try { client.delete().forPath(getLockPath(path)); } catch (KeeperException.NoNodeException ignored) { } catch (Exception e) { throw new Exception("Could not release the lock: " + getLockPath(pathInZooKeeper) + '.', e); } } 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();  }