> > You mention threading in the subject and you have a (binding > [...] ...) form. Are you starting a thread, or communicating with > one, or using pmap, future, an agent, or etc. inside the binding, > and expecting the binding to affect the code that runs in the thread/ > map/future/agent? > ------------------------------------------------ Yes and no. The server created by the create-server calls calls the handler :
(defn handle-client [in out] (binding [ *in* (reader in) ] (with-connection db (let [outstream-agent (agent (writer out)) The above code is afaik executing in its own thread. But since I'm just starting to use clojure I'm not fully understanding whats going on inside the sql package so it could be that some of the things you mentioned are happening inside the sql lib. The strange thing is that everything works, except that the first reply gets lost. It looks as if opening a database connection has some negative impact on printing to the outstream in this case. Maybe some problem caused by initializing the JDBC driver from inside a thread ? BTW: The reply function looks now like that: (defn send-back-to-client [out xml] (. out println xml) (. out flush) ) (defn send-answers [messages] (loop [message (first messages) remaining-messages (rest messages)] (if message (let [{outstream-agent :outstream-agent xml-message :message} message] (send-off outstream-agent send-back-to-client xml-message) (recur (first remaining-messages) (rest remaining-messages)))))) Regards Roger --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---