Repository: curator Updated Branches: refs/heads/master dd20f1dbe -> e9bfb4353
keep consistent with the default session id defined in ZooKeeper Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/e9bfb435 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/e9bfb435 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/e9bfb435 Branch: refs/heads/master Commit: e9bfb4353ae75dd5aa369ae4aa76b9d8cadb7e50 Parents: dd20f1d Author: Fangmin Lyu <allen...@fb.com> Authored: Tue Nov 1 16:05:39 2016 -0700 Committer: Fangmin Lyu <allen...@fb.com> Committed: Tue Nov 1 16:05:39 2016 -0700 ---------------------------------------------------------------------- .../java/org/apache/curator/ConnectionState.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/e9bfb435/curator-client/src/main/java/org/apache/curator/ConnectionState.java ---------------------------------------------------------------------- diff --git a/curator-client/src/main/java/org/apache/curator/ConnectionState.java b/curator-client/src/main/java/org/apache/curator/ConnectionState.java index 9712899..7044ddf 100644 --- a/curator-client/src/main/java/org/apache/curator/ConnectionState.java +++ b/curator-client/src/main/java/org/apache/curator/ConnectionState.java @@ -163,7 +163,7 @@ class ConnectionState implements Watcher, Closeable for ( Watcher parentWatcher : parentWatchers ) { - OperationTrace trace = new OperationTrace("connection-state-parent-process", tracer.get()); + OperationTrace trace = new OperationTrace("connection-state-parent-process", tracer.get(), getSessionId()); parentWatcher.process(event); trace.commit(); } @@ -213,16 +213,14 @@ class ConnectionState implements Watcher, Closeable * Return the current session id */ public long getSessionId() { - long sessionId = -1; - if (isConnected()) { - try { - ZooKeeper zk = zooKeeper.getZooKeeper(); - if (zk != null) { - sessionId = zk.getSessionId(); - } - } catch (Exception e) { - // Ignore the exception + long sessionId = 0; + try { + ZooKeeper zk = zooKeeper.getZooKeeper(); + if (zk != null) { + sessionId = zk.getSessionId(); } + } catch (Exception e) { + // Ignore the exception } return sessionId; }