storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [01/10] git commit: Do not rely on spaces to separate command args
Date Tue, 22 Apr 2014 16:39:13 GMT
Repository: incubator-storm
Updated Branches:
  refs/heads/master 8f3949534 -> 93612f565


Do not rely on spaces to separate command args


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

Branch: refs/heads/master
Commit: 47387185b1c8b61b24c8c3be1675e4e4f2c670c6
Parents: ea0f54e
Author: Derek Dagit <derekd@yahoo-inc.com>
Authored: Sun Jan 12 00:48:52 2014 +0000
Committer: Derek Dagit <derekd@yahoo-inc.com>
Committed: Wed Jan 15 03:16:51 2014 +0000

----------------------------------------------------------------------
 .../clj/backtype/storm/daemon/supervisor.clj    | 38 ++++++++++++--------
 storm-core/src/clj/backtype/storm/util.clj      |  4 +--
 2 files changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/47387185/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
index 43cb6fe..9bff2ad 100644
--- a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -447,22 +447,30 @@
           stormjar (supervisor-stormjar-path stormroot)
           storm-conf (read-supervisor-storm-conf conf storm-id)
           classpath (add-to-classpath (current-classpath) [stormjar])
-          childopts (.replaceAll (str (conf WORKER-CHILDOPTS) " " (storm-conf TOPOLOGY-WORKER-CHILDOPTS))
-                                 "%ID%"
-                                 (str port))
+          worker-childopts (when-let [s (conf WORKER-CHILDOPTS)]
+                             (.replaceAll s "%ID%" (str port)))
+          topo-worker-childopts (when-let [s (conf TOPOLOGY-WORKER-CHILDOPTS)]
+                                  (.replaceAll s "%ID%" (str port)))
           logfilename (str "worker-" port ".log")
-          command (str "java -server " childopts
-                       " -Djava.library.path=" (conf JAVA-LIBRARY-PATH)
-                       " -Dlogfile.name=" logfilename
-                       " -Dstorm.home=" storm-home
-                       " -Dlogback.configurationFile=" storm-home "/logback/cluster.xml"
-                       " -Dstorm.id=" storm-id
-                       " -Dworker.id=" worker-id
-                       " -Dworker.port=" port
-                       " -cp " classpath " backtype.storm.daemon.worker "
-                       (java.net.URLEncoder/encode storm-id) " " (:assignment-id supervisor)
-                       " " port " " worker-id)]
-      (log-message "Launching worker with command: " command)
+          command ["java"
+                   "-server"
+                   worker-childopts
+                   topo-worker-childopts
+                   (str "-Djava.library.path=" (conf JAVA-LIBRARY-PATH))
+                   (str "-Dlogfile.name=" logfilename)
+                   (str "-Dstorm.home=" storm-home)
+                   (str "-Dlogback.configurationFile=" storm-home "/logback/cluster.xml")
+                   (str "-Dstorm.id=" storm-id)
+                   (str "-Dworker.id=" worker-id)
+                   (str "-Dworker.port=" port)
+                   "-cp" classpath
+                   "backtype.storm.daemon.worker"
+                   (java.net.URLEncoder/encode storm-id)
+                   (:assignment-id supervisor)
+                   port
+                   worker-id]
+          command (->> command (map str) (filter (complement empty?)))]
+      (log-message "Launching worker with command: " (clojure.string/join " " command))
       (launch-process command :environment {"LD_LIBRARY_PATH" (conf JAVA-LIBRARY-PATH)})
       ))
 

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/47387185/storm-core/src/clj/backtype/storm/util.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/util.clj b/storm-core/src/clj/backtype/storm/util.clj
index 2ab30c7..a3d5ebb 100644
--- a/storm-core/src/clj/backtype/storm/util.clj
+++ b/storm-core/src/clj/backtype/storm/util.clj
@@ -395,9 +395,7 @@
     ))
 
 (defnk launch-process [command :environment {}]
-  (let [command (->> (seq (.split command " "))
-                     (filter (complement empty?)))
-        builder (ProcessBuilder. command)
+  (let [builder (ProcessBuilder. command)
         process-env (.environment builder)]
     (doseq [[k v] environment]
       (.put process-env k v))


Mime
View raw message