Hi Drew, I've been trying to recreate your issue.... (defn forever[x] (while true (Thread/sleep 100) (print \-) (flush))) (let [a (agent 0)] (send (agent 0) forever)) (println (Thread/activeCount) "threads active") (shutdown-agents) (println "I'm here") ;(System/exit 0)
Notably shutdown-agents is a non-blocking call, and without the exit the program runs forever. With the exit, for me the program terminates - but I believe this is where the behavior which may vary... something different occurring in your environment to mine - shutodown hooks? JVM? My only other stab in the dark is could your (flush) actually block before System/exit is called? Can you try my example and see if it hangs for you, and/or if there some code you can paste that hangs? Regards, Tim. On May 28, 6:08 am, Drew Raines <aarai...@gmail.com> wrote: > billh04 wrote: > > I think you are responsible for ending the currently running > > agents. The usual method is to set up some field which the agents > > monitor looking for some value indicating the application is > > ending. > > By "ending currently running agents" do you mean the action run on > the agent? My problem doesn't seem to be action-related because when > I take out the agents and execute the same code synchronously, the > JVM exits as I expect. > > For the record, I was able to consistently hang the JVM indefinitely > from the command line in addition to invocation from cron, contrary > to my claim in my other message. I suspect that others are not > seeing any issues because most Java environments are persistent. > Anyone else scripting with Clojure using agents? > > Thanks. > > -Drew --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---