Nwang/improve curator connection error message (#3327)
* Improve the error messages for blockUntilConnected(). The current messages sound like client construction issue
* update two more error messages
diff --git a/heron/statemgrs/src/java/org/apache/heron/statemgr/zookeeper/curator/CuratorStateManager.java b/heron/statemgrs/src/java/org/apache/heron/statemgr/zookeeper/curator/CuratorStateManager.java
index 78129cc..3e0e63f 100644
--- a/heron/statemgrs/src/java/org/apache/heron/statemgr/zookeeper/curator/CuratorStateManager.java
+++ b/heron/statemgrs/src/java/org/apache/heron/statemgr/zookeeper/curator/CuratorStateManager.java
@@ -118,10 +118,10 @@
try {
if (!client.blockUntilConnected(ZkContext.connectionTimeoutMs(newConfig),
TimeUnit.MILLISECONDS)) {
- throw new RuntimeException("Failed to initialize CuratorClient");
+ throw new RuntimeException("Failed to connect to " + connectionString);
}
} catch (InterruptedException e) {
- throw new RuntimeException("Failed to initialize CuratorClient", e);
+ throw new RuntimeException("Interrupted from blockUntilConnected(): " + connectionString, e);
}
if (ZkContext.isInitializeTree(newConfig)) {
@@ -335,7 +335,8 @@
// Suppress it since forPath() throws Exception
// SUPPRESS CHECKSTYLE IllegalCatch
} catch (Exception e) {
- safeSetException(future, new RuntimeException("Could not getNodeData", e));
+ safeSetException(future, new RuntimeException(
+ "Could not getNodeData using watcher for path: " + path, e));
}
return future;
@@ -448,7 +449,7 @@
public static void main(String[] args) throws ExecutionException, InterruptedException,
IllegalAccessException, ClassNotFoundException, InstantiationException {
if (args.length < 2) {
- throw new RuntimeException("Expects arguments: <topology_name> <zookeeper_hostname>");
+ throw new RuntimeException("Expects 2 arguments: <topology_name> <zookeeper_hostname>");
}
String zookeeperHostname = args[1];