Not receiving all data after attempting to close the channel.
Pape, Stephen R CTR USAF AFMC AFRL/RISE
Stephen.Pape.ctr at RL.af.mil
Thu Nov 19 10:24:17 EST 2009
Hello,
I'm having a problem with both 3.2.0.ALPHA1 and 3.1.5.GA (haven't tested
other versions).
Basically, in order to make sure that all pending data is written, I have
something like this:
private volatile ChannelFuture writeFuture = null;
private volatile Channel channel = null; // Set later
public void write(Object obj)
{
writeFuture = channel.write(obj);
}
public void close()
{
If(this.writeFuture != null)
this.writeFuture.addListener(this);
else
this.channel.close();
}
public void operationComplete(ChannelFuture future)
{
// Thread.sleep(1000);
future.getChannel.close();
}
This class is being used to write Objects in a loop. Immediately after the
loop the close method is called.
I verified that the correct writeFuture is being used in the close() method,
but the remote side is not receiving all of the data. When I write 10
objects across, sometimes only 7 or 8 will make it through.
If I uncomment Thread.sleep(), all of the data is consistently received by
the remote side, so it would seem somehow I'm closing the channel too early.
Is there something I'm doing wrong?
Thanks!
-Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20091119/5cb87a8d/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5186 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20091119/5cb87a8d/attachment.bin
More information about the netty-users
mailing list