incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/3] git commit: Fixed BLUR-155
Date Wed, 26 Jun 2013 19:02:32 GMT
Fixed BLUR-155


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/bd9adf00
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/bd9adf00
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/bd9adf00

Branch: refs/heads/master
Commit: bd9adf0085fa1829688acb5aff4468c080abc3f5
Parents: 01b303d
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Wed Jun 26 15:01:08 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Wed Jun 26 15:01:08 2013 -0400

----------------------------------------------------------------------
 .../java/org/apache/blur/zookeeper/WatchChildren.java     |  5 +++--
 .../java/org/apache/blur/zookeeper/WatchNodeData.java     |  9 +++++++--
 .../org/apache/blur/zookeeper/WatchNodeExistance.java     | 10 +++++++---
 3 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bd9adf00/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java b/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
index e9c3b72..5352ba3 100644
--- a/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
+++ b/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
@@ -80,9 +80,10 @@ public class WatchChildren implements Closeable {
         while (_running.get()) {
           synchronized (_lock) {
             try {
-              _children = _zooKeeper.getChildren(_path, watcher);
+              List<String> children = _zooKeeper.getChildren(_path, watcher);
               try {
-                onChange.action(_children);
+                onChange.action(children);
+                _children = children;
               } catch (Throwable t) {
                 LOG.error("Unknown error during onchange action [" + this + "].", t);
               }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bd9adf00/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java b/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java
index 9a3c1b6..eda18f0 100644
--- a/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java
+++ b/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java
@@ -76,8 +76,13 @@ public class WatchNodeData implements Closeable {
                 LOG.debug("Path [{0}] not found.", _path);
                 return;
               }
-              _data = _zooKeeper.getData(_path, watcher, stat);
-              onChange.action(_data);
+              byte[] data = _zooKeeper.getData(_path, watcher, stat);
+              try {
+                onChange.action(data);
+                _data = data;
+              } catch (Throwable t) {
+                LOG.error("Unknown error during onchange action [" + this + "].", t);
+              }
               _lock.wait();
             } catch (KeeperException e) {
               if (!_running.get()) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bd9adf00/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java b/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
index d23a4c3..c84aebc 100644
--- a/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
+++ b/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
@@ -30,7 +30,6 @@ import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.KeeperException.Code;
 import org.apache.zookeeper.data.Stat;
 
-
 public class WatchNodeExistance implements Closeable {
 
   private final static Log LOG = LogFactory.getLog(WatchNodeExistance.class);
@@ -69,8 +68,13 @@ public class WatchNodeExistance implements Closeable {
         while (_running.get()) {
           synchronized (_lock) {
             try {
-              _stat = _zooKeeper.exists(_path, watcher);
-              onChange.action(_stat);
+              Stat stat = _zooKeeper.exists(_path, watcher);
+              try {
+                onChange.action(stat);
+                _stat = stat;
+              } catch (Throwable t) {
+                LOG.error("Unknown error during onchange action [" + this + "].", t);
+              }
               _lock.wait();
             } catch (KeeperException e) {
               if (!_running.get()) {


Mime
View raw message