Skip to content

Commit 4f8cf59

Browse files
committed
Fixed bug around fast registration and unregistration in JDKPoller
Looks like it might be a bug in the JDK registry
1 parent d6b1f28 commit 4f8cf59

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/engineering/swat/watch/Watcher.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public class Watcher {
3535
private Watcher(WatchScope scope, Path path) {
3636
this.scope = scope;
3737
this.path = path;
38-
logger.info("Constructor logger for: {} at {} level", path, scope);
3938
}
4039

4140
/**

src/main/java/engineering/swat/watch/impl/JDKPoller.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ public static Closeable register(SubscriptionKey path, Consumer<List<WatchEvent<
110110
@Override
111111
public void close() throws IOException {
112112
logger.debug("Closing watch for: {}", path);
113-
key.cancel();
114-
watchers.remove(key);
113+
if (watchers.remove(key, changesHandler)) {
114+
key.cancel();
115+
}
115116
}
116117
};
117118
})

0 commit comments

Comments
 (0)