Skip to content

Commit

Permalink
watcher: Expose isClosed method
Browse files Browse the repository at this point in the history
Signed-off-by: Giri Ramasamy <46867712+giri-vsr@users.noreply.github.com>
  • Loading branch information
giri-vsr committed May 13, 2024
1 parent cdd5cd9 commit 0906498
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions jetcd-core/src/main/java/io/etcd/jetcd/Watch.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 2 additions & 1 deletion jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ final class WatcherImpl implements Watcher {
//
// ************************

boolean isClosed() {
@Override
public boolean isClosed() {
return this.closed.get() || WatchImpl.this.closed.get();
}

Expand Down

0 comments on commit 0906498

Please sign in to comment.