storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kabh...@apache.org
Subject [3/5] storm git commit: Revert "STORM-3184: remove guava dependency"
Date Tue, 14 Aug 2018 14:24:58 GMT
Revert "STORM-3184: remove guava dependency"

This reverts commit 0fe39c8844f1d7e508b4f314942e26ee66bb503b.


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/3358effa
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/3358effa
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/3358effa

Branch: refs/heads/master
Commit: 3358effa636d7e405971f3dc0ab19ed9ec8ae76d
Parents: 0fe39c8
Author: Arun Mahadevan <arunm@apache.org>
Authored: Sat Aug 11 20:58:49 2018 -0700
Committer: Arun Mahadevan <arunm@apache.org>
Committed: Sat Aug 11 20:58:49 2018 -0700

----------------------------------------------------------------------
 storm-client/pom.xml                            |  6 ++++
 .../org/apache/storm/daemon/worker/Worker.java  |  4 +--
 .../jvm/org/apache/storm/utils/ConfigUtils.java | 38 +++++---------------
 .../org/apache/storm/daemon/nimbus/Nimbus.java  |  2 +-
 .../java/org/apache/storm/DaemonConfigTest.java |  2 +-
 5 files changed, 19 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/3358effa/storm-client/pom.xml
----------------------------------------------------------------------
diff --git a/storm-client/pom.xml b/storm-client/pom.xml
index 7c28cce..c925ffd 100644
--- a/storm-client/pom.xml
+++ b/storm-client/pom.xml
@@ -97,6 +97,12 @@
 
         <!-- end of transitive dependency management -->
 
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>${guava.version}</version>
+        </dependency>
+
         <!-- test -->
         <dependency>
             <groupId>org.mockito</groupId>

http://git-wip-us.apache.org/repos/asf/storm/blob/3358effa/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java b/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java
index c0dfc0a..9f8428b 100644
--- a/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java
+++ b/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java
@@ -278,8 +278,8 @@ public class Worker implements Shutdownable, DaemonCommon {
         setupFlushTupleTimer(topologyConf, newExecutors);
         setupBackPressureCheckTimer(topologyConf);
 
-        LOG.info("Worker has topology config {}", ConfigUtils.maskPasswords(Utils.redactValue(topologyConf,
-                Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD)));
+        LOG.info("Worker has topology config {}", Utils.redactValue(ConfigUtils.maskPasswords(topologyConf),
+                Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD));
         LOG.info("Worker {} for storm {} on {}:{}  has finished loading", workerId, topologyId,
assignmentId, port);
         return this;
     }

http://git-wip-us.apache.org/repos/asf/storm/blob/3358effa/storm-client/src/jvm/org/apache/storm/utils/ConfigUtils.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/utils/ConfigUtils.java b/storm-client/src/jvm/org/apache/storm/utils/ConfigUtils.java
index 064365d..5fefcea 100644
--- a/storm-client/src/jvm/org/apache/storm/utils/ConfigUtils.java
+++ b/storm-client/src/jvm/org/apache/storm/utils/ConfigUtils.java
@@ -26,9 +26,9 @@ import java.util.Map;
 import java.util.Random;
 import java.util.Set;
 import java.util.function.BooleanSupplier;
-import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
+import com.google.common.collect.Maps;
 import org.apache.storm.Config;
 import org.apache.storm.daemon.supervisor.AdvancedFSOps;
 import org.apache.storm.generated.StormTopology;
@@ -79,34 +79,14 @@ public class ConfigUtils {
         return oldInstance;
     }
 
-    private static class MaskedConf implements Supplier<Map<String, Object>>
{
-        private final Map<String, Object> conf;
-
-        MaskedConf(Map<String, Object> conf) {
-            this.conf = conf;
-        }
-
-        @Override
-        public Map<String, Object> get() {
-            Map<String, Object> res = new HashMap<>();
-            for (Map.Entry<String, Object> e : conf.entrySet()) {
-                if (passwordConfigKeys.contains(e.getKey())) {
-                    res.put(e.getKey(), "*****");
-                } else {
-                    res.put(e.getKey(), e.getValue());
-                }
-            }
-            return res;
-        }
-
-        @Override
-        public String toString() {
-            return get().toString();
-        }
-    }
-
-    public static Supplier<Map<String, Object>> maskPasswords(Map<String,
Object> conf) {
-        return new MaskedConf(conf);
+    public static Map<String, Object> maskPasswords(final Map<String, Object>
conf) {
+        Maps.EntryTransformer<String, Object, Object> maskPasswords =
+                new Maps.EntryTransformer<String, Object, Object>() {
+                    public Object transformEntry(String key, Object value) {
+                        return passwordConfigKeys.contains(key) ? "*****" : value;
+                    }
+                };
+        return Maps.transformEntries(conf, maskPasswords);
     }
 
     public static boolean isLocalMode(Map<String, Object> conf) {

http://git-wip-us.apache.org/repos/asf/storm/blob/3358effa/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
index 13f430d..b66153b 100644
--- a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
+++ b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
@@ -3075,7 +3075,7 @@ public class Nimbus implements Iface, Shutdownable, DaemonCommon {
             }
             LOG.info("Received topology submission for {} (storm-{} JDK-{}) with conf {}",
topoName,
                      topoVersionString, topology.get_jdk_version(),
-                    ConfigUtils.maskPasswords(Utils.redactValue(topoConf, Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD)));
+                     Utils.redactValue(ConfigUtils.maskPasswords(topoConf), Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD));
 
             // lock protects against multiple topologies being submitted at once and
             // cleanup thread killing topology in b/w assignment and starting the topology

http://git-wip-us.apache.org/repos/asf/storm/blob/3358effa/storm-server/src/test/java/org/apache/storm/DaemonConfigTest.java
----------------------------------------------------------------------
diff --git a/storm-server/src/test/java/org/apache/storm/DaemonConfigTest.java b/storm-server/src/test/java/org/apache/storm/DaemonConfigTest.java
index de7c378..2304f77 100644
--- a/storm-server/src/test/java/org/apache/storm/DaemonConfigTest.java
+++ b/storm-server/src/test/java/org/apache/storm/DaemonConfigTest.java
@@ -97,7 +97,7 @@ public class DaemonConfigTest {
         Map<String, Object> conf = new HashMap<>();
         conf.put(DaemonConfig.LOGVIEWER_HTTPS_KEY_PASSWORD, "pass1");
         conf.put(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS, 100);
-        Map result = ConfigUtils.maskPasswords(conf).get();
+        Map result = ConfigUtils.maskPasswords(conf);
         Assert.assertEquals("*****", result.get(DaemonConfig.LOGVIEWER_HTTPS_KEY_PASSWORD));
         Assert.assertEquals(100, result.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS));
     }


Mime
View raw message