@Override
    public void releaseAll() throws Exception {
        Collection<String> children = getAllHandles();

        Exception exception = null;

        for (String child : children) {
            try {
                release(child);
            } catch (Exception e) {
                exception = ExceptionUtils.firstOrSuppressed(e, exception);
            }
        }

        if (exception != null) {
            throw new Exception("Could not properly release all state nodes.", exception);
        }
    }
@Test
    void testReleaseAll() throws Exception {
        final TestingLongStateHandleHelper longStateStorage = new TestingLongStateHandleHelper();

        ZooKeeperStateHandleStore<TestingLongStateHandleHelper.LongStateHandle> zkStore =
                new ZooKeeperStateHandleStore<>(getZooKeeperClient(), longStateStorage);

        final Collection<String> paths = Arrays.asList("/state1", "/state2", "/state3");

        for (String path : paths) {
            zkStore.addAndLock(path, new TestingLongStateHandleHelper.LongStateHandle(42L));
        }

        for (String path : paths) {
            Stat stat =
                    getZooKeeperClient().checkExists().forPath(zkStore.getInstanceLockPath(path));

            assertThat(stat).as("Expecte and existing lock.").isNotNull();
        }

        zkStore.releaseAll();

        for (String path : paths) {
            Stat stat =
                    getZooKeeperClient()
                            .checkExists()
                            .forPath(ZooKeeperStateHandleStore.getRootLockPath(path));

            assertThat(stat.getNumChildren()).isZero();
        }
    }