incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Reordering some logic to match the shard server.
Date Mon, 14 Oct 2013 01:18:00 GMT
Updated Branches:
  refs/heads/master 8691ee015 -> 0c90d7349


Reordering some logic to match the shard server.


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

Branch: refs/heads/master
Commit: 0c90d7349552b81fce07c7b13b0eca33424ef465
Parents: 8691ee0
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Oct 13 21:17:22 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Oct 13 21:17:40 2013 -0400

----------------------------------------------------------------------
 .../blur/thrift/BlurControllerServer.java       | 26 +++++++++++---------
 1 file changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/0c90d734/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
index 6e4a75f..158c8e8 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
@@ -280,27 +280,29 @@ public class BlurControllerServer extends TableAdmin implements Iface
{
   }
 
   private void registerMyself() {
+    // Register Node
     try {
-      String version = BlurUtil.getVersion();
-      String onlineControllerPath = ZookeeperPathConstants.getOnlineControllersPath() + "/"
+ _nodeName;
-      while (_zookeeper.exists(onlineControllerPath, false) != null) {
-        LOG.info("Node [{0}] already registered, waiting for path [{1}] to be released",
_nodeName,
-            onlineControllerPath);
-        Thread.sleep(3000);
+      String controllerPath = ZookeeperPathConstants.getControllersPath() + "/" + _nodeName;
+      if (_zookeeper.exists(controllerPath, false) == null) {
+        //Don't set the version for the registered nodes but only to the online nodes.
+        _zookeeper.create(controllerPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
       }
-      _zookeeper.create(onlineControllerPath, version.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
     } catch (KeeperException e) {
       throw new RuntimeException(e);
     } catch (InterruptedException e) {
       throw new RuntimeException(e);
     }
-
+    
+    // Wait for other instances (named the same name) to die
     try {
-      String controllerPath = ZookeeperPathConstants.getControllersPath() + "/" + _nodeName;
-      if (_zookeeper.exists(controllerPath, false) == null) {
-        //Don't set the version for the registered nodes but only to the online nodes.
-        _zookeeper.create(controllerPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+      String version = BlurUtil.getVersion();
+      String onlineControllerPath = ZookeeperPathConstants.getOnlineControllersPath() + "/"
+ _nodeName;
+      while (_zookeeper.exists(onlineControllerPath, false) != null) {
+        LOG.info("Node [{0}] already registered, waiting for path [{1}] to be released",
_nodeName,
+            onlineControllerPath);
+        Thread.sleep(3000);
       }
+      _zookeeper.create(onlineControllerPath, version.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
     } catch (KeeperException e) {
       throw new RuntimeException(e);
     } catch (InterruptedException e) {


Mime
View raw message