Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added some stats functions

  • Loading branch information...
commit 98eb79c0e2cadbae91bed96bfe079ffb18c8d7bc 1 parent f799a79
@amitrathore authored
View
6 src/org/rathore/amit/medusa/core.clj
@@ -73,8 +73,14 @@
(defn current-pool-size []
(.getPoolSize THREADPOOL))
+(defn max-pool-size []
+ (.getMaximumPoolSize THREADPOOL))
+
(defn completed-task-count []
(.getCompletedTaskCount THREADPOOL))
(defn futures-count []
(count @running-futures))
+
+(defn medusa-stats []
+ {:queued (number-of-queued-tasks) :current-threads (current-pool-size) :max-threads (max-pool-size) :completed (completed-task-count)})
View
7 src/org/rathore/amit/medusa/utils.clj
@@ -2,3 +2,10 @@
(defn random-uuid []
(str (java.util.UUID/randomUUID)))
+
+(defn threadpool-factory [thread-name-prefix]
+ (proxy [java.util.concurrent.ThreadFactory] []
+ (newThread [r]
+ (let [t (Thread. r)]
+ (.setName t (str thread-name-prefix (random-uuid)))
+ t))))
Please sign in to comment.
Something went wrong with that request. Please try again.