Created
July 16, 2012 17:50
-
-
Save anonymous/3124000 to your computer and use it in GitHub Desktop.
This future seems to time out OK, but CPU usage hits the roof thereafter...
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
(let [process (future(recur))] | |
(try | |
(.get process 1000 java.util.concurrent.TimeUnit/MILLISECONDS) | |
(catch java.util.concurrent.TimeoutException e | |
(do | |
(println"Terminating due to" e) | |
(println"Termination="(future-cancel process)))))) |
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
Terminating due to #<TimeoutException java.util.concurrent.TimeoutException> | |
Termination= true | |
nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment