/** * Get a map of version to worker main from the conf Config.SUPERVISOR_WORKER_VERSION_MAIN_MAP * * @param conf what to read it out of * @return the map */ public static NavigableMap<SimpleVersion, String> getConfiguredWorkerMainVersions(Map<String, Object> conf) { TreeMap<SimpleVersion, String> ret = new TreeMap<>(); Map<String, String> fromConf = (Map<String, String>) conf.getOrDefault(Config.SUPERVISOR_WORKER_VERSION_MAIN_MAP, Collections.emptyMap()); for (Map.Entry<String, String> entry : fromConf.entrySet()) { ret.put(new SimpleVersion(entry.getKey()), entry.getValue()); } ret.put(VersionInfo.OUR_VERSION, "org.apache.storm.daemon.worker.Worker"); return ret; }
/** * Get a map of version to worker log writer from the conf Config.SUPERVISOR_WORKER_VERSION_LOGWRITER_MAP * * @param conf what to read it out of * @return the map */ public static NavigableMap<SimpleVersion, String> getConfiguredWorkerLogWriterVersions(Map<String, Object> conf) { TreeMap<SimpleVersion, String> ret = new TreeMap<>(); Map<String, String> fromConf = (Map<String, String>) conf.getOrDefault(Config.SUPERVISOR_WORKER_VERSION_LOGWRITER_MAP, Collections.emptyMap()); for (Map.Entry<String, String> entry : fromConf.entrySet()) { ret.put(new SimpleVersion(entry.getKey()), entry.getValue()); } ret.put(VersionInfo.OUR_VERSION, "org.apache.storm.LogWriter"); return ret; }
/** * Get a map of version to classpath from the conf Config.SUPERVISOR_WORKER_VERSION_CLASSPATH_MAP * * @param conf what to read it out of * @param currentCP the current classpath for this version of storm (not included in the conf, but returned by this) * @return the map */ public static NavigableMap<SimpleVersion, List<String>> getConfiguredClasspathVersions(Map<String, Object> conf, List<String> currentCP) { TreeMap<SimpleVersion, List<String>> ret = new TreeMap<>(); Map<String, String> fromConf = (Map<String, String>) conf.getOrDefault(Config.SUPERVISOR_WORKER_VERSION_CLASSPATH_MAP, Collections.emptyMap()); for (Map.Entry<String, String> entry : fromConf.entrySet()) { ret.put(new SimpleVersion(entry.getKey()), Arrays.asList(entry.getValue().split(File.pathSeparator))); } ret.put(VersionInfo.OUR_VERSION, currentCP); return ret; }
topoVersionString = (String) _conf.getOrDefault(Config.SUPERVISOR_WORKER_DEFAULT_VERSION, VersionInfo.getVersion()); final SimpleVersion topoVersion = new SimpleVersion(topoVersionString);
private boolean supportRpcHeartbeat(TopologyDetails topo) { if (!topo.getTopology().is_set_storm_version()) { // current version supports RPC heartbeat return true; } String stormVersionStr = topo.getTopology().get_storm_version(); SimpleVersion stormVersion = new SimpleVersion(stormVersionStr); return stormVersion.compareTo(MIN_VERSION_SUPPORT_RPC_HEARTBEAT) >= 0; }
SimpleVersion topoVersion = new SimpleVersion(topoVersionString); List<String> cp = Utils.getCompatibleVersion(supervisorClasspaths, topoVersion, "classpath", null); if (cp == null) {
@Test public void testParseStorm0xSnapshot() { SimpleVersion version = new SimpleVersion("0.10.3-SNAPSHOT"); Assert.assertEquals(0, version.getMajor()); Assert.assertEquals(10, version.getMinor()); }
@Test public void testParseStorm1x() { SimpleVersion version = new SimpleVersion("1.0.4"); Assert.assertEquals(1, version.getMajor()); Assert.assertEquals(0, version.getMinor()); }
@Test public void testParseStorm1xSnapshot() { SimpleVersion version = new SimpleVersion("1.0.4-SNAPSHOT"); Assert.assertEquals(1, version.getMajor()); Assert.assertEquals(0, version.getMinor()); }
@Test public void testParseStorm2xSnapshot() { SimpleVersion version = new SimpleVersion("2.1.2-SNAPSHOT"); Assert.assertEquals(2, version.getMajor()); Assert.assertEquals(1, version.getMinor()); }
@Test public void testParseStorm2x() { SimpleVersion version = new SimpleVersion("2.1.2"); Assert.assertEquals(2, version.getMajor()); Assert.assertEquals(1, version.getMinor()); }
@Test public void testParseStorm0x() { SimpleVersion version = new SimpleVersion("0.10.3"); Assert.assertEquals(0, version.getMajor()); Assert.assertEquals(10, version.getMinor()); }