Questions about asynchronous write operations

Trustin Lee tlee at redhat.com
Sat Apr 18 10:23:56 EDT 2009


On Sat, Apr 18, 2009 at 3:30 AM, Nicholas Clare <nickclare at gmail.com> wrote:
> Hi Utkarsh,
>
> I'm not totally sure about the first question, but I believe that they
> are written properly.

You are right.  Two write requests never get mixed up.  They are
written in the order where write() was called.

> The second question I do know, because I was
> reading the code involved just a little while ago. In the
> DefaultChannelListener class, it checks whether the task represented
> by the future is done when you add it, and if so, it is called. So the
> answer is yes, your listener will be called no matter if it's added
> before or after the write finishes

Exactly.  If the operation associated with a ChannelFuture is already
done, any newly added ChannelFutureListener will be notified
immediately.

BTW, you meant DefaultChannelFuture rather than
DefaultChannelListener, right? ;)

Thanks!
Trustin



More information about the netty-users mailing list