Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
0.10.0
-
None
Description
Netty Client hold batch object until IO operation complete.
Following code:
Client.java
final int numMessages = batch.size(); pendingMessages.getAndAdd(numMessages); LOG.debug("writing {} messages to channel {}", batch.size(), channel.toString()); ChannelFuture future = channel.write(batch); future.addListener(new ChannelFutureListener() { public void operationComplete(ChannelFuture future) throws Exception { pendingMessages.getAndAdd(0 - numMessages); if (future.isSuccess()) { LOG.debug("sent {} messages to {}", numMessages, dstAddressPrefixedName); messagesSent.getAndAdd(batch.size()); }
batch will be a field of anonymous inner classes.don't release after channel.write() invoked,until IO operation complete.