Skip to content

Instantly share code, notes, and snippets.

Created July 16, 2012 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3124000 to your computer and use it in GitHub Desktop.
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...
(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))))))
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