You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2015/08/24 15:51:57 UTC
[12/50] [abbrv] storm git commit: Leveraging NimbusInfo/parse.
Leveraging NimbusInfo/parse.
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/eb242e0f
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/eb242e0f
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/eb242e0f
Branch: refs/heads/master
Commit: eb242e0f6e1681825d005dbadb19649684025e01
Parents: dc24e44
Author: Parth Brahmbhatt <br...@gmail.com>
Authored: Fri Dec 19 15:52:17 2014 -0800
Committer: Parth Brahmbhatt <br...@gmail.com>
Committed: Fri Dec 19 15:52:17 2014 -0800
----------------------------------------------------------------------
storm-core/src/clj/backtype/storm/zookeeper.clj | 9 ++++-----
storm-core/src/jvm/backtype/storm/nimbus/NimbusInfo.java | 4 ++++
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/eb242e0f/storm-core/src/clj/backtype/storm/zookeeper.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/zookeeper.clj b/storm-core/src/clj/backtype/storm/zookeeper.clj
index a058098..ae017e6 100644
--- a/storm-core/src/clj/backtype/storm/zookeeper.clj
+++ b/storm-core/src/clj/backtype/storm/zookeeper.clj
@@ -221,10 +221,9 @@
[id (if (clojure.string/blank? (.getId participant))
(throw (RuntimeException. "No nimbus leader participant host found, have you started your nimbus hosts?"))
(.getId participant))
- server (first (.split id ":"))
- port (Integer/parseInt (last (.split id ":")))
- is-leader (.isLeader participant)]
- (NimbusInfo. server port is-leader)))
+ nimbus-info (NimbusInfo/parse id)]
+ (.setLeader nimbus-info (.isLeader participant))
+ nimbus-info))
(defn leader-latch-listener-impl
"Leader latch listener that will be invoked when we either gain or lose leadership"
@@ -254,7 +253,7 @@
(let [servers (conf STORM-ZOOKEEPER-SERVERS)
zk (mk-client conf (conf STORM-ZOOKEEPER-SERVERS) (conf STORM-ZOOKEEPER-PORT) :auth-conf conf)
leader-lock-path (str (conf STORM-ZOOKEEPER-ROOT) "/leader-lock")
- id (str (.getCanonicalHostName (InetAddress/getLocalHost)) ":" (conf NIMBUS-THRIFT-PORT))
+ id (.toHostPortString (NimbusInfo/fromConf conf))
leader-latch (atom (LeaderLatch. zk leader-lock-path id))
leader-latch-listener (atom (leader-latch-listener-impl conf zk @leader-latch))
]
http://git-wip-us.apache.org/repos/asf/storm/blob/eb242e0f/storm-core/src/jvm/backtype/storm/nimbus/NimbusInfo.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/nimbus/NimbusInfo.java b/storm-core/src/jvm/backtype/storm/nimbus/NimbusInfo.java
index 1b96bbf..bf56e2d 100644
--- a/storm-core/src/jvm/backtype/storm/nimbus/NimbusInfo.java
+++ b/storm-core/src/jvm/backtype/storm/nimbus/NimbusInfo.java
@@ -56,6 +56,10 @@ public class NimbusInfo implements Serializable {
return host;
}
+ public void setLeader(boolean isLeader) {
+ this.isLeader = isLeader;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;