Skip to content

Commit

Permalink
add utility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ztellman committed Nov 18, 2011
1 parent 9446d8b commit 95c1559
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/org/rathore/amit/medusa/core.clj
Expand Up @@ -91,3 +91,15 @@
:max-threads (max-pool-size)
:completed (completed-task-count)
:active-threads (active-thread-count)})

(defn await-completion [seconds]
(.awaitTermination THREADPOOL seconds java.util.concurrent.TimeUnit/SECONDS))

(defn await-empty-queue
([]
(await-empty-queue 100))
([millis-step]
(loop [size (number-of-queued-tasks)]
(when-not (zero? size)
(Thread/sleep millis-step)
(recur (number-of-queued-tasks))))))

0 comments on commit 95c1559

Please sign in to comment.