boonproject / boon

Simple opinionated Java for the novice to expert level Java Programmer. Low Ceremony. High Productivity.
http://richardhightower.github.io/site/Boon/Welcome.html
Apache License 2.0
520 stars 102 forks source link

etcd: provide way to cleanly terminate the ongoing requests #339

Open oakad opened 9 years ago

oakad commented 9 years ago

A common pattern while using etcd is waiting on some key to change (using etcd.wait(handler, ...) in this library's case). A common sub-case of the above pattern is that wait request never invokes its handler (because no changes were detected or application has to shut down or do some other modifications to its run time state).

Therefore, it will be handy to have a way to cancel those requests without waiting for completion, both individually and all pending requests at once. The later appears to be easy to achieve by exposing the scheduledExecutorService in the EtcdClient and using its shutdown() and awaitTermination() methods.

RichardHightower commented 9 years ago

I have not kept this up to date. I am not sure when or if I can come back to it. I thought we would be using etcd a lot but we don't. I spent most of my time working with Consul. You are welcome to fork this and add changes at will.