File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 88
88
; ; can customize the supervisors (except for ports) by passing in map for :supervisors parameter
89
89
; ; if need to customize amt of ports more, can use add-supervisor calls afterwards
90
90
(defnk mk-local-storm-cluster [:supervisors 2 :ports-per-supervisor 3 :daemon-conf {}]
91
- (let [zk-port 2181
91
+ (let [zk-port ( available-port 2181 )
92
92
daemon-conf (merge (read-storm-config )
93
93
{TOPOLOGY-SKIP-MISSING-SERIALIZATIONS true
94
94
ZMQ-LINGER-MILLIS 0
Original file line number Diff line number Diff line change 22
22
(defn local-hostname []
23
23
(.getCanonicalHostName (InetAddress/getLocalHost )))
24
24
25
+ (letfn [(try-port [port]
26
+ (with-open [socket (java.net.ServerSocket. port)]
27
+ (.getLocalPort socket)))]
28
+ (defn available-port
29
+ ([] (try-port 0 ))
30
+ ([preferred]
31
+ (try
32
+ (try-port preferred)
33
+ (catch java.io.IOException e
34
+ (available-port ))))))
35
+
25
36
(defn uuid []
26
37
(str (UUID/randomUUID )))
27
38
You can’t perform that action at this time.
0 commit comments