watcher.close() throw the EtcdException(InterruptedException)
Jetcd will throw an EtcdException if you close an on going listened watcher.
The InterruptedException exception caused by this.eventsQueue.take(); when you interrupted the thread.
For this.eventsQueue.take(); , it is an exception if the thread is interrupted. But for Jetcd the expected behavior for the watcher.close() method is to get the thread interrupted. So why does Jetcd raise an EtcdException exception?
Caused by: java.lang.InterruptedException
at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:404)
at java.util.concurrent.FutureTask.get(FutureTask.java:191)
at com.coreos.jetcd.internal.impl.WatchImpl$WatcherImpl.listen(WatchImpl.java:449)
... 4 more
@jalenyang are you expecting that the behavior of watcher.close() just simply close watcher and not throw any exception?
@jalenyang kindly ping?
@fanminshi yes, my opinion is watcher.close() just simply close watcher and not throw any exception.
I checked your changes, but I think it is an InterruptedException instead of ExecutionException.
So you should return a default WatchResponse when InterruptedException happen.