Hi all, do you have any idea how I can define a variable, global or inside a function, used to store for example the FutureTask objects resulted from ExecutorService submit(fn) call,I want to put all futures in a collection and later call 'get' on each of them. bellow is a sample of that code:
(defn sample-fc [] (def futures '()) (dotimes [i 3] (def f (. thread-pool (submit (fn [] ("task result !!!"))))) (cons f futures) ) "shutdown the pool" (. thread-pool shutdown) (. thread-pool awaitTermination (. Long MAX_VALUE) (. TimeUnit SECONDS)) "go through all futures an call get on them" (doseq [f futures] (println (. f get)) ) ) when I do 'dosync' futures collection is empty, even if (def f (. thread-pool (submit (fn [] ("task result !!!"))))) is a a non empty object of type FutureTask(java.util.concurrent package). Do you know how to define 'futures' variable such that to keep all returned future ? thanks, Sorin -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.