jurmous / etcd4j

Java / Netty client for etcd, the highly-available key value store for shared configuration and service discovery.
Apache License 2.0
267 stars 83 forks source link

Hangs on waitForChange if connection breaks #134

Open BalogAbel opened 7 years ago

BalogAbel commented 7 years ago

Hy!

Is there any way to get notified if the connection to the etcd server dies during a waitForChange?

Sample code:

try {
    EtcdClient etcdClient = new EtcdClient(URI.create(System.getenv("etcd1.local")))
    EtcdResponsePromise<EtcdKeysResponse> request = etcdClient.getDir("testDir").recursive().waitForChange().send();
    request.addListener(promise -> {
        //it is not executed if I kill the etcd server 

    });
} catch (Exception e) {
    //it is not executed if I kill the etcd server
}
sheinbergon commented 7 years ago

etcd4j version 2.12.0 is broken. please make sure to use 2.11.0

lburgazzoli commented 7 years ago

etcd4j 2.13.0 has been released, should be available soon on maven central.

@Bumper03 do you mind testing against the latest version and by setting a retry handle that stops after a number of re-connection attempts ?