incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [3/7] git commit: Changed from sleep calls to wait calls, seems cleaner.
Date Sun, 31 Mar 2013 15:10:55 GMT
Changed from sleep calls to wait calls, seems cleaner.


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

Branch: refs/heads/0.1.5
Commit: 36b778463e6bffa295f9656356f72534b11e15d5
Parents: 7985140
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Mar 31 10:18:49 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Mar 31 10:18:49 2013 -0400

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


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/36b77846/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java b/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
index 8c7c3da..d58255a 100644
--- a/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
+++ b/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
@@ -68,7 +68,7 @@ public class WatchChildren implements Closeable {
     _watchThread = new Thread(new Runnable() {
       @Override
       public void run() {
-//        startDoubleCheckThread();
+        startDoubleCheckThread();
         while (_running.get()) {
           synchronized (_lock) {
             try {
@@ -127,7 +127,9 @@ public class WatchChildren implements Closeable {
       public void run() {
         while (_running.get()) {
           try {
-            Thread.sleep(_delay);
+            synchronized (_running) {
+              _running.wait(_delay);
+            }
             if (!_running.get()) {
               return;
             }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/36b77846/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java b/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java
index abc57ed..ee8a9c3 100644
--- a/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java
+++ b/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeData.java
@@ -31,7 +31,6 @@ import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.KeeperException.Code;
 import org.apache.zookeeper.data.Stat;
 
-
 public class WatchNodeData implements Closeable {
 
   private final static Log LOG = LogFactory.getLog(WatchNodeData.class);
@@ -107,7 +106,9 @@ public class WatchNodeData implements Closeable {
       public void run() {
         while (_running.get()) {
           try {
-            Thread.sleep(_delay);
+            synchronized (_running) {
+              _running.wait(_delay);
+            }
             if (!_running.get()) {
               return;
             }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/36b77846/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
b/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
index 3a3a3a4..4dc384b 100644
--- a/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
+++ b/src/blur-util/src/main/java/org/apache/blur/zookeeper/WatchNodeExistance.java
@@ -98,7 +98,9 @@ public class WatchNodeExistance implements Closeable {
       public void run() {
         while (_running.get()) {
           try {
-            Thread.sleep(_delay);
+            synchronized (_running) {
+              _running.wait(_delay);
+            }
             if (!_running.get()) {
               return;
             }


Mime
View raw message