On Dec 2, 3:10 am, Ivan Sagalaev <[email protected]> wrote:
> My question is how to model a non-blocking I/O.
netty is excellent if you want NIO for performance. But for requesting
a URL - really quite massively overkill. You can write a URL request
in a threaded way very simply (even containing a callback if you want
one):
(ns fin
(:require [clojure.contrib.duck-streams :as ds]))
(defn history [stock]
(ds/read-lines
(java.net.URL. (str "http://ichart.finance.yahoo.com/table.csv?s="
stock "&a=0&b=1&c=2003&ignore=.csv"))))
(defn callback [] (println "done!"))
(future (history "RIO.AX") (callback))
So it really depends on your goals.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en