Skip to content

Commit

Permalink
Merge branch 'STORM-1492' of https://github.com/HeartSaVioR/storm int…
Browse files Browse the repository at this point in the history
…o STORM-1492Q

STORM-1492 With nimbus.seeds set to default, a nimbus for localhost may appear "Offline"

This closes #1082
  • Loading branch information
Robert Evans committed Sep 11, 2017
2 parents ed6dca0 + 6fbd3d4 commit a42b10a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions storm-client/src/jvm/org/apache/storm/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

import com.google.common.collect.Lists;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.input.ClassLoaderObjectInputStream;
import org.apache.storm.Config;
Expand Down Expand Up @@ -106,6 +107,7 @@ public class Utils {
public static final String DEFAULT_STREAM_ID = "default";
private static final Set<Class> defaultAllowedExceptions = new HashSet<>();
public static final String FILE_PATH_SEPARATOR = System.getProperty("file.separator");
private static final List<String> LOCALHOST_ADDRESSES = Lists.newArrayList("localhost", "127.0.0.1", "0:0:0:0:0:0:0:1");

private static ThreadLocal<TSerializer> threadSer = new ThreadLocal<TSerializer>();
private static ThreadLocal<TDeserializer> threadDes = new ThreadLocal<TDeserializer>();
Expand Down Expand Up @@ -1505,4 +1507,8 @@ public static Map<String, Object> getConfigFromClasspath(List<String> cp, Map<St
}
return defaultsConf;
}

public static boolean isLocalhostAddress(String address) {
return LOCALHOST_ADDRESSES.contains(address);
}
}
2 changes: 1 addition & 1 deletion storm-core/src/clj/org/apache/storm/ui/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@
(nimbus-summary
(.get_nimbuses (.getClusterInfo ^Nimbus$Client nimbus)))))
([nimbuses]
(let [nimbus-seeds (set (map #(str %1 ":" (*STORM-CONF* NIMBUS-THRIFT-PORT)) (set (*STORM-CONF* NIMBUS-SEEDS))))
(let [nimbus-seeds (set (map #(str %1 ":" (*STORM-CONF* NIMBUS-THRIFT-PORT)) (remove #(Utils/isLocalhostAddress %) (set (*STORM-CONF* NIMBUS-SEEDS)))))
alive-nimbuses (set (map #(str (.get_host %1) ":" (.get_port %1)) nimbuses))
offline-nimbuses (clojure.set/difference nimbus-seeds alive-nimbuses)
offline-nimbuses-summary (map #(convert-to-nimbus-summary %1) offline-nimbuses)]
Expand Down

0 comments on commit a42b10a

Please sign in to comment.