Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added in ability for users to include pre-installed jars to the classpath #749

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion storm-core/src/clj/backtype/storm/daemon/supervisor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
stormroot (supervisor-stormdist-root conf storm-id)
stormjar (supervisor-stormjar-path stormroot)
storm-conf (read-supervisor-storm-conf conf storm-id)
classpath (add-to-classpath (current-classpath) [stormjar])
classpath (add-to-classpath (current-classpath) [stormjar (storm-conf TOPOLOGY-WORKER-CLASSPATH)])
childopts (.replaceAll (str (conf WORKER-CHILDOPTS) " " (storm-conf TOPOLOGY-WORKER-CHILDOPTS))
"%ID%"
(str port))
Expand Down
2 changes: 1 addition & 1 deletion storm-core/src/clj/backtype/storm/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@
(System/getProperty "java.class.path"))

(defn add-to-classpath [classpath paths]
(str/join ":" (cons classpath paths)))
(str/join ":" (cons classpath (remove str/blank? paths))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the File/pathSeparator here in place of ":"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, JVM classpath always uses a colon.


(defn ^ReentrantReadWriteLock mk-rw-lock []
(ReentrantReadWriteLock.))
Expand Down
6 changes: 6 additions & 0 deletions storm-core/src/jvm/backtype/storm/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,12 @@ public class Config extends HashMap<String, Object> {
public static final String TOPOLOGY_WORKER_CHILDOPTS="topology.worker.childopts";
public static final Object TOPOLOGY_WORKER_CHILDOPTS_SCHEMA = String.class;

/**
* Topology-specific options for the worker child process classpath.
*/
public static final String TOPOLOGY_WORKER_CLASSPATH="topology.worker.classpath";
public static final Object TOPOLOGY_WORKER_CLASSPATH_SCHEMA = String.class;

/**
* This config is available for TransactionalSpouts, and contains the id ( a String) for
* the transactional topology. This id is used to store the state of the transactional
Expand Down
8 changes: 8 additions & 0 deletions storm-core/test/clj/backtype/storm/utils_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@
))
)
)

(deftest test-add-to-classpath
(is (= (add-to-classpath "a:b", ["", nil]) "a:b"))
(is (= (add-to-classpath "a:b", ["c", nil]) "a:b:c"))
(is (= (add-to-classpath "a:b", ["c", "d:e"]) "a:b:c:d:e"))
)