Colin Yates wrote:
> I have a scheduler which creates a future that basically
> does a (while true (let [next-job (.take queue)]...)),
> where queue is a LinkedBlockingQueue. The problem is that
> once it is running, because futures aren't daemon threads
> it hangs lein.

Instead of .take, you can use .poll with a timeout, then
have your loop check if it's been told to shut down, e.g. by
setting an Atom.

Alternately, inject a "poison" message into the queue that
tells the loop to shut down.

My preferred approach to handling run-time services like
this is to inject them into the app when it starts, thereby
avoiding global Vars.

-S

-- 
-- 
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/groups/opt_out.


Reply via email to