@Override public boolean hasWatchService(final FileSystem fs) { return fileSystems.contains(fs.getName()); }
@Override public void addWatchService(final FileSystem fs, final WatchService ws) { fileSystems.add(fs.getName()); watchServices.add(ws);
private void cleanupDeletedFS(FileSystem fs) { WatchService ws = watchServicesByFS.remove(fs.getName()); if (ws != null && !ws.isClose()) { ws.close(); } fs.getRootDirectories().forEach(rootPath -> indexEngine.delete(KObjectUtil.toKCluster(rootPath))); }
private void cleanupDeletedFS(FileSystem fs) { WatchService ws = watchServicesByFS.remove(fs.getName()); if (ws != null && !ws.isClose()) { ws.close(); } fs.getRootDirectories().forEach(rootPath -> indexEngine.delete(KObjectUtil.toKCluster(rootPath))); }
private boolean deleteFS(final FileSystem fileSystem) { final File gitDir = ((JGitFileSystemImpl) fileSystem).getGit().getRepository().getDirectory(); fileSystem.close(); fileSystem.dispose(); try { if (System.getProperty("os.name").toLowerCase().contains("windows")) { //this operation forces a cache clean freeing any lock -> windows only issue! WindowCache.reconfigure(new WindowCacheConfig()); } FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY); fsManager.remove(fileSystem.getName()); cleanupParentDir(gitDir); return true; } catch (java.io.IOException e) { throw new IOException("Failed to remove the git repository.", e); } }
assertThat(fsCache.getFileSystems()).contains(fs2.getName()); assertThat(fsCache.getFileSystems()).contains(fs3.getName()); assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs2.getName()); assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs3.getName()); assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs3.getName()); assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).doesNotContain(fs2.getName());
assertThat(fsCache.getFileSystems()).contains(fs2.getName()); assertThat(fsCache.getFileSystems()).contains(fs3.getName()); assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs2.getName()); assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs3.getName()); assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs3.getName()); assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).doesNotContain(fs2.getName());