Updated Branches: refs/heads/apache-blur-0.2 6536d48e1 -> 3247fb2e6
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/3247fb2e Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/3247fb2e Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/3247fb2e Branch: refs/heads/apache-blur-0.2 Commit: 3247fb2e6d0942a3dd7823297436ed27f0e092ba Parents: 6536d48 Author: Aaron McCurry <[email protected]> Authored: Sun Oct 13 21:17:22 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Sun Oct 13 21:17:22 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/3247fb2e/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) {
