Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (def nashorn (.getEngineByName (ScriptEngineManager.) "nashorn"))
- (def pool (Executors/newFixedThreadPool 4))
- (def tasks (for [i (range 10)] #(my-fun %)))
- (def futures (.invokeAll pool tasks))
- (for [ftr futures]
- (.get ftr))
- ;; There's only one nashorn engine that gets shared across the 4 threads, right?
- ;; What does that mean for how the work is distributed if each invocation of `my-fun` tries to execute some javascript
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement