@Override
    public void release(String pathInZooKeeper) throws Exception {
        final String path = normalizePath(pathInZooKeeper);
        final String lockPath = getInstanceLockPath(path);
        try {
            deleteIfExists(lockPath);
        } catch (Exception e) {
            throw new Exception("Could not release the lock: " + lockPath + '.', e);
        }
    }
@Test
    void testRelease() throws Exception {
        final TestingLongStateHandleHelper longStateStorage = new TestingLongStateHandleHelper();

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

        final String path = "/state";

        zkStore.addAndLock(path, new TestingLongStateHandleHelper.LongStateHandle(42L));

        final String lockPath = zkStore.getInstanceLockPath(path);

        Stat stat = getZooKeeperClient().checkExists().forPath(lockPath);

        assertThat(stat).as("Expected an existing lock").isNotNull();

        zkStore.release(path);

        stat =
                getZooKeeperClient()
                        .checkExists()
                        .forPath(ZooKeeperStateHandleStore.getRootLockPath(path));

        // release should have removed the lock child
        assertThat(stat.getNumChildren()).as("Expected no lock nodes as children").isZero();

        zkStore.releaseAndTryRemove(path);

        stat = getZooKeeperClient().checkExists().forPath(path);

        assertThat(stat).as("State node should have been removed.").isNull();
    }