On Wed, Jul 7, 2010 at 1:43 PM, Zach Tellman <ztell...@gmail.com> wrote:

> Developers are still required to "participate" in the NIO design, in
> that blocking calls in the request handler need to be avoided to reap
> the full benefits.  Netty provides a lot of nice abstractions over
> NIO, but kind of punts on how to effectively manage the concurrency it
> requires.  Clojure's concurrency primitives don't really have a
> counterpart in Netty, so I don't see why they shouldn't be used.
>

So something like this:

(defn hello-world [request]
  (future
   (Thread/sleep 1)
   (respond! request
             {:status 200
              :headers {"Content-Type" "text/html"}
              :body "Hello world!"})))

Is non-blocking and perfectly fine?


> If you really want access to Netty, though, (:channel request) will
> return an org.jboss.netty.channel.Channel object, which will allow you
> to do pretty much anything you want.
>

Great!

-- 
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

Reply via email to