Created
January 1, 2010 17:47
-
-
Save krukow/267173 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 [[sf st] (wrap (constantly 42))] | |
(def #^{:private true}s sf) | |
(def #^{:private true}f (wrap-with (fn [] (throw (Exception.))) st)) | |
(def state st)) | |
(dotimes [i 10] | |
(s)) | |
(assert (= (ClosedState default-policy 0) @state)) | |
(dotimes [i 5] | |
(try (f) (catch Exception e))) | |
(assert (= (ClosedState default-policy 5) @state)) | |
(try (f) (catch Exception e)) | |
(assert (= (class (OpenState default-policy 0)) (class @state))) | |
(Thread/sleep 5000) | |
(s) | |
(assert (= (ClosedState default-policy 0) @state)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment