Client Channel and thread safety

Shay Banon kimchy at gmail.com
Mon Oct 12 15:02:49 EDT 2009


(sorry for posting this again, I was not subscribed to the mailing
list, so I am not sure it got there...)

Hi,

   Quick questions, when using client bootstrap, and connecting to a
specific host, I get a channel back. My questions are:

1. Can the client bootstrap be used to connect to different host+port?
(I am pretty sure yes, just making sure).
2. Is the Channel that you get back from the connect operation thread
safe? i.e., can I do something like this:

public void send() {
    ChannelBuffer cb = ... (build a new channel buffer, and fill it
with content)
    shardsChannel.write(cb)
}

When channel is shared between threads, and the send method can be
called concurrently?

Thanks,
Shay


More information about the netty-users mailing list