PersistentManager implements Closeable { @Override public synchronized void close() throws IOException { FilterServiceFileUtils.releaseDirectoryLock(fileLock); } PersistentManager(Path persistentPath); @Override synchronized void close();  }
@Test public void testLockAndReleaseLock() throws Exception { final Path lockPath = tempDirPath.resolve("lock_path"); final PersistentManager<BloomFilter> manager = new PersistentManager<>(lockPath); assertThatThrownBy(() -> new PersistentManager<>(lockPath)) .isInstanceOf(OverlappingFileLockException.class); manager.close(); new PersistentManager<>(lockPath); }