SHOW:
|
|
- or go back to the newest paste.
| 1 | - | (defn scheduler [] |
| 1 | + | (defn scheduler-stop [executor] |
| 2 | - | "Create an executor for executing fns in an own thread." |
| 2 | + | (.shutdown executor)) |
| 3 | ||
| 4 | - | (fn |
| 4 | + | (defn scheduler-stop-now [executor] |
| 5 | - | ([k] |
| 5 | + | (.shutdownNow executor)) |
| 6 | - | (cond |
| 6 | + | |
| 7 | - | (= k :stop) (.shutdown executor) |
| 7 | + | (defn scheduler-once-create |
| 8 | - | (= k :stop-now) (.shutdownNow executor))) |
| 8 | + | [f d] |
| 9 | - | ([k f d] |
| 9 | + | |
| 10 | - | (cond |
| 10 | + | (.schedule executor f d TimeUnit/MILLISECONDS) |
| 11 | - | (= k :once) (.schedule executor f d TimeUnit/MILLISECONDS) |
| 11 | + | executor)) |