Skip to content

Commit

Permalink
get out of executor datafy biz
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Jan 29, 2025
1 parent 07de58f commit b7466fb
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/main/clojure/clojure/core/async/flow/impl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,10 @@
(defonce io-exec clojure.lang.Agent/soloExecutor)
(defonce compute-exec clojure.lang.Agent/pooledExecutor)

(defn oid [x]
(symbol (str (-> x class .getSimpleName) "@" (-> x System/identityHashCode Integer/toHexString))))

(defn exec->data [exec]
(let [ess (as-> (str exec) ^String es
(.substring es (inc (.lastIndexOf es "[")) (.lastIndexOf es "]"))
(.split es ","))]
(merge {:id (oid exec)
:status (first ess)} ;;TODO less fragile
(zipmap [:pool-size :active-threads :queued-tasks :completed-tasks]
(map #(-> ^String % (.substring (inc (.lastIndexOf ^String % " "))) Long.) (rest ess))))))

(defn datafy [x]
(condp instance? x
clojure.lang.Fn (-> x str symbol)
ExecutorService (exec->data x)
ExecutorService (str x)
clojure.lang.Var (symbol x)
(datafy/datafy x)))

Expand Down

0 comments on commit b7466fb

Please # to comment.