Questions about asynchronous write operations
Utkarsh Srivastava
utkarsh at gmail.com
Fri Apr 17 12:12:26 EDT 2009
Hi,
I had 2 questions about asynchronous write operations to channels
1. If I do a sequence of 2 writes to a channel, e.g.,
/*Channel channel;*/
channel.write(obj1);
channel.write(obj2);
Since the write operations are asynchronous, will the writing of obj1
and obj2 be properly serialized, or can this result in garbage on the
wire?
2. The write operation returns a ChannelFuture to which I can add a
listener for completion of the write. But it seems like there is a
race condition here. What if the write finishes before I can add a
listener. Will my listener still be called?
ChannelFuture future = channel.write(obj);
//write completes
future.addListener(listener);
//Will the listener be called?
Thanks for the help,
Utkarsh
More information about the netty-users
mailing list