From c5aa2fdb5609b8ce6361b3cc71d40ae30c2bd6c8 Mon Sep 17 00:00:00 2001 From: aalmiray Date: Wed, 8 Nov 2017 19:10:35 -0600 Subject: [PATCH] Create a `WatchService` using a matching `FileSystem` instead of the default. Signed-off-by: aalmiray --- .../eclipse/fx/core/internal/FileSystemServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/internal/FileSystemServiceImpl.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/internal/FileSystemServiceImpl.java index d8066e180..cfbb01ed1 100644 --- a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/internal/FileSystemServiceImpl.java +++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/internal/FileSystemServiceImpl.java @@ -13,7 +13,7 @@ import java.io.IOException; import java.net.URISyntaxException; import java.nio.file.ClosedWatchServiceException; -import java.nio.file.FileSystems; +import java.nio.file.FileSystem; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardWatchEventKinds; @@ -62,7 +62,7 @@ public Subscription observePath(URI uri, BiConsumer consumer) { @Override public Subscription observePath(Path path, BiConsumer consumer) { if (this.thread == null || !this.thread.isAlive()) { - this.thread = new CheckThread(); + this.thread = new CheckThread(path.getFileSystem()); this.thread.start(); } try { @@ -78,10 +78,10 @@ static class CheckThread extends Thread { private final Executor dispatcher = Executors.newCachedThreadPool(); private final Thread shutdownCleanup; - public CheckThread() { + public CheckThread(FileSystem fileSystem) { setDaemon(true); try { - this.watcher = FileSystems.getDefault().newWatchService(); + this.watcher = fileSystem.newWatchService(); } catch (IOException e) { throw new IllegalStateException(); }