Skip to content

Commit 55cde2a

Browse files
committed
sysprop named fn should take workflow tag and return es instance or nil
1 parent c026cbd commit 55cde2a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/main/clojure/clojure/core/async/impl/dispatch.clj

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,21 @@
8282

8383
(defn- executor-ctor
8484
[workflow]
85-
#(Executors/newCachedThreadPool (counted-thread-factory (str "async-" (name %) "-%d") true)))
85+
(Executors/newCachedThreadPool (counted-thread-factory (str "async-" (name workflow) "-%d") true)))
8686

87-
(def ^:private workflow->es-ctor
88-
{:compute (executor-ctor :compute)
89-
:io (executor-ctor :io)
90-
:mixed (executor-ctor :mixed)})
87+
(defn- default-construct-executor
88+
[workload]
89+
(case workload
90+
:compute (executor-ctor :compute)
91+
:io (executor-ctor :io)
92+
:mixed (executor-ctor :mixed)))
9193

9294
(defn construct-executor
9395
[workload]
94-
(let [default-ctor (workflow->es-ctor workload)]
95-
(if-let [sysprop-ctor (when-let [esf (System/getProperty "clojure.core.async.executor-factory")]
96-
(requiring-resolve (symbol esf)))]
97-
(or (sysprop-ctor workload) (default-ctor workload))
98-
(default-ctor workload))))
96+
(if-let [sysprop-ctor (when-let [esf (System/getProperty "clojure.core.async.executor-factory")]
97+
(requiring-resolve (symbol esf)))]
98+
(or (sysprop-ctor workload) (default-construct-executor workload))
99+
(default-construct-executor workload)))
99100

100101
(def executor-for
101102
{:compute (construct-executor :compute)

0 commit comments

Comments
 (0)