Created
May 2, 2018 17:18
-
-
Save lnostdal/fc19dbc9e4c61b6b90d3b94969385be6 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
(let [f (future | |
(try | |
(Thread/sleep 10000) | |
(catch Throwable e | |
(println e) | |
(println "isInterrupted:" (.isInterrupted (Thread/currentThread))) | |
(println "isAlive:" (.isAlive (Thread/currentThread))) | |
(println "interrupted:" (Thread/interrupted)))))] | |
(Thread/sleep 500) | |
(future-cancel f) | |
nil) | |
#error { | |
:cause sleep interrupted | |
:via | |
[{:type java.lang.InterruptedException | |
:message sleep interrupted | |
:at [java.lang.Thread sleep Thread.java -2]}] | |
:trace | |
[[java.lang.Thread sleep Thread.java -2] | |
[quantataraxia.core$eval66118$fn__66119 invoke form-init2480698204249510623.clj 3] | |
[clojure.core$binding_conveyor_fn$fn__5564 invoke core.clj 2022] | |
[clojure.lang.AFn call AFn.java 18] | |
[java.util.concurrent.FutureTask run FutureTask.java 264] | |
[java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1135] | |
[java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 635] | |
[java.lang.Thread run Thread.java 844]]} | |
isInterrupted: false | |
isAlive: true | |
interrupted: false | |
Author
lnostdal
commented
May 2, 2018
•
I should also be catching InterruptedException !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment