Created
April 5, 2014 16:26
-
-
Save brunoV/9994113 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '[java.util.concurrent RejectedExecutionHandler])) | |
(def block-policy | |
"When the threadpool is maxed out, submit the runnable to the pool blockingly." | |
(reify RejectedExecutionHandler | |
(rejectedExecution [this runnable thread-pool] | |
(try | |
(.put (.getQueue thread-pool) runnable) | |
(catch InterruptedException e | |
(.interrupt (.currentThread Thread))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment