Log curator state changes SUSPENDED, RECONNECTED and LOST
@@ -34,6 +34,7 @@ import java.util.List;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.function.Function;
+import java.util.logging.Logger;
/**
* Curator interface for Vespa.
@@ -47,6 +48,8 @@ import java.util.function.Function;
*/
public class Curator implements AutoCloseable {
+ private static final Logger logger = Logger.getLogger(Curator.class.getName());
+
private static final int ZK_SESSION_TIMEOUT = 30000;
private static final int ZK_CONNECTION_TIMEOUT = 30000;
@@ -201,7 +204,11 @@ public class Curator implements AutoCloseable {
// To avoid getting warning in log, see ticket 6389740
private void addFakeListener() {
curatorFramework.getConnectionStateListenable().addListener((curatorFramework, connectionState) -> {
- // empty, not needed now
+ switch (connectionState) {
+ case SUSPENDED: logger.info("ZK connection state change: SUSPENDED"); break;
+ case RECONNECTED: logger.info("ZK connection state change: RECONNECTED"); break;
+ case LOST: logger.warning("ZK connection state change: LOST"); break;
+ }
});
}
