Commit 65c0c08e authored by Roman Shevchenko's avatar Roman Shevchenko Committed by Maxim Mossienko
Browse files

IDEA-CR-43310: [vfs] removes unneeded synchronization from FileWatcher#isOperational (IDEA-180274)

Implementations are able to report the status immediately after the instantiation, so there is no need to wait for the initialization to complete.

(cherry picked from commit 194838d0)
parent d424dae8
Branches unavailable Tags unavailable
No related merge requests found
Showing with 1 addition and 3 deletions
+1 -3
......@@ -97,14 +97,13 @@ public class FileWatcher {
private final ExecutorService myFileWatcherExecutor = Registry.is("vfs.filewatcher.works.in.async.way") ?
AppExecutorUtil.createBoundedApplicationPoolExecutor("File Watcher", 1) :
MoreExecutors.newDirectExecutorService();
private final Future<?> myWatcherInitialization;
FileWatcher(@NotNull ManagingFS managingFS) {
myManagingFS = managingFS;
myNotificationSink = new MyFileWatcherNotificationSink();
myWatchers = PluggableFileWatcher.EP_NAME.getExtensions();
myWatcherInitialization = myFileWatcherExecutor.submit(() -> {
myFileWatcherExecutor.submit(() -> {
for (PluggableFileWatcher watcher : myWatchers) {
watcher.initialize(myManagingFS, myNotificationSink);
}
......@@ -120,7 +119,6 @@ public class FileWatcher {
}
public boolean isOperational() {
waitForFuture(myWatcherInitialization);
for (PluggableFileWatcher watcher : myWatchers) {
if (watcher.isOperational()) return true;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment