WIP Project: http://git-wip-us.apache.org/repos/asf/incubator-twill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-twill/commit/efc1bee3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-twill/tree/efc1bee3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-twill/diff/efc1bee3
Branch: refs/heads/feature/TWILL-153 Commit: efc1bee30120855b71bb3573e1fe987e1f154a42 Parents: 93cd03a Author: Terence Yim <[email protected]> Authored: Tue Sep 22 22:10:08 2015 -0700 Committer: Terence Yim <[email protected]> Committed: Tue Sep 22 22:10:08 2015 -0700 ---------------------------------------------------------------------- .../twill/internal/zookeeper/RewatchOnExpireWatcher.java | 7 +++++++ twill-zookeeper/src/test/resources/logback-test.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/efc1bee3/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireWatcher.java ---------------------------------------------------------------------- diff --git a/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireWatcher.java b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireWatcher.java index 776efe4..712a2f6 100644 --- a/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireWatcher.java +++ b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireWatcher.java @@ -78,6 +78,8 @@ final class RewatchOnExpireWatcher implements Watcher { if (event.getState() != Event.KeeperState.Expired) { return; } + LOG.debug("ZK session expired: {} {}", client.getConnectString(), event); + switch (actionType) { case EXISTS: exists(); @@ -95,6 +97,7 @@ final class RewatchOnExpireWatcher implements Watcher { Futures.addCallback(client.exists(path, this), new FutureCallback<Stat>() { @Override public void onSuccess(Stat stat) { + LOG.debug("Rewatch on exists succeeded: {}", path); // Since we know all callbacks and watcher are triggered from single event thread, there is no race condition. Object oldResult = lastResult.getReference(); lastResult.compareAndSet(oldResult, null, true, false); @@ -102,12 +105,15 @@ final class RewatchOnExpireWatcher implements Watcher { if (stat != oldResult && (stat == null || !stat.equals(oldResult))) { if (stat == null) { // previous stat is not null, means node deleted + LOG.debug("Node deleted before rewatch on exists {}", path); process(new WatchedEvent(Event.EventType.NodeDeleted, Event.KeeperState.SyncConnected, path)); } else if (oldResult == null) { // previous stat is null, means node created + LOG.debug("Node created before rewatch on exists {}", path); process(new WatchedEvent(Event.EventType.NodeCreated, Event.KeeperState.SyncConnected, path)); } else { // Otherwise, something changed on the node + LOG.debug("Node event before rewatch on exists {}", path); process(new WatchedEvent(Event.EventType.NodeDataChanged, Event.KeeperState.SyncConnected, path)); } } @@ -115,6 +121,7 @@ final class RewatchOnExpireWatcher implements Watcher { @Override public void onFailure(Throwable t) { + LOG.debug("Rewatch on exists failed"); if (RetryUtils.canRetry(t)) { exists(); } else { http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/efc1bee3/twill-zookeeper/src/test/resources/logback-test.xml ---------------------------------------------------------------------- diff --git a/twill-zookeeper/src/test/resources/logback-test.xml b/twill-zookeeper/src/test/resources/logback-test.xml index 90350cb..227abce 100644 --- a/twill-zookeeper/src/test/resources/logback-test.xml +++ b/twill-zookeeper/src/test/resources/logback-test.xml @@ -27,7 +27,7 @@ limitations under the License. <logger name="org.apache.hadoop" level="WARN" /> <logger name="org.apache.zookeeper" level="WARN" /> - <root level="INFO"> + <root level="DEBUG"> <appender-ref ref="STDOUT"/> </root> </configuration>
