diff --git a/jetcd-core/src/main/java/io/etcd/jetcd/Watch.java b/jetcd-core/src/main/java/io/etcd/jetcd/Watch.java index f50d11fe..8e15afe9 100644 --- a/jetcd-core/src/main/java/io/etcd/jetcd/Watch.java +++ b/jetcd-core/src/main/java/io/etcd/jetcd/Watch.java @@ -226,6 +226,11 @@ interface Watcher extends Closeable { @Override void close(); + /** + * Returns if watcher is already closed + */ + boolean isClosed(); + /** * Requests the latest revision processed and propagates it to listeners */ diff --git a/jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java b/jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java index f8e3ff44..797b6ddf 100644 --- a/jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java +++ b/jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java @@ -143,7 +143,8 @@ final class WatcherImpl implements Watcher { // // ************************ - boolean isClosed() { + @Override + public boolean isClosed() { return this.closed.get() || WatchImpl.this.closed.get(); }