You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2014/05/14 17:10:53 UTC
[04/12] git commit: Fixed some places where background callbacks
weren't checking the event result code
Fixed some places where background callbacks weren't checking the event result code
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6e815598
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6e815598
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6e815598
Branch: refs/heads/CURATOR-96
Commit: 6e8155981e6a67e9aab595908092b3778c2ca993
Parents: fe54e88
Author: randgalt <ra...@apache.org>
Authored: Sat Apr 12 15:53:47 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sat Apr 12 15:53:47 2014 -0500
----------------------------------------------------------------------
.../curator/framework/recipes/cache/PathChildrenCache.java | 5 ++++-
.../apache/curator/framework/recipes/queue/ChildrenCache.java | 6 +++++-
.../curator/framework/recipes/queue/DistributedQueue.java | 5 +++++
3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/6e815598/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
index d66f7f3..0599499 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
@@ -473,7 +473,10 @@ public class PathChildrenCache implements Closeable
@Override
public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
{
- processChildren(event.getChildren(), mode);
+ if ( event.getResultCode() == KeeperException.Code.OK.intValue() )
+ {
+ processChildren(event.getChildren(), mode);
+ }
}
};
http://git-wip-us.apache.org/repos/asf/curator/blob/6e815598/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
index eb1f43d..5619c59 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
@@ -24,6 +24,7 @@ import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.BackgroundCallback;
import org.apache.curator.framework.api.CuratorEvent;
import org.apache.curator.framework.api.CuratorWatcher;
+import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import java.io.Closeable;
import java.io.IOException;
@@ -56,7 +57,10 @@ class ChildrenCache implements Closeable
@Override
public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
{
- setNewChildren(event.getChildren());
+ if ( event.getResultCode() == KeeperException.Code.OK.intValue() )
+ {
+ setNewChildren(event.getChildren());
+ }
}
};
http://git-wip-us.apache.org/repos/asf/curator/blob/6e815598/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
index f92071b..a04cad7 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
@@ -431,6 +431,11 @@ public class DistributedQueue<T> implements QueueBase<T>
@Override
public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
{
+ if ( event.getResultCode() != KeeperException.Code.OK.intValue() )
+ {
+ return;
+ }
+
if ( event.getType() == CuratorEventType.CREATE )
{
synchronized(putCount)