Conversion of ChannelBuffer to InputStream
이희승 (Trustin Lee)
trustin at gmail.com
Tue Sep 1 01:11:26 EDT 2009
On Sun, 30 Aug 2009 23:59:46 +0900 (KST)
MikeQ <michaelquilleash at hotmail.com> wrote:
>
> Thanks for the reply Trustin.
>
> I will look into the PipedInput/OutputStream.
>
> >> - Do I need to use a OrderedMemoryAwareThreadPoolExecutor
> >> somewhere? If so where?
>
> >I'd place it before handing off the buffer to the blocking stream so
> >that other connections are not blocked by the blocking I/O in your
> >code.
>
> OK thanks, that is what I figured. However is it then not possible
> to get a race between events coming from the same channel before they
> reach the OrderedMemoryAwareThreadPoolExecutor? Should I be using an
> OrderedMemoryAwareThreadPoolExecutor as the worker executor when
> creating the ServerBootstrap? Or does Netty only allow one worker
> thread per channel at a time?
Once a channel is connected, it is tied to one I/O worker thread, and
therefore there's no chance of race condition. You are fine with using
Executors.newCachedThreadPool(), just like the examples.
HTH,
Trustin
--
Trustin Lee, http://gleamynode.net/
More information about the netty-users
mailing list