You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by "zhanghailei (JIRA)" <ji...@apache.org> on 2015/05/25 03:28:17 UTC
[jira] [Updated] (STORM-835) Netty Client hold batch object until
io operation complete
[ https://issues.apache.org/jira/browse/STORM-835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
zhanghailei updated STORM-835:
------------------------------
Description:
Netty Client hold batch object until IO operation complete.
Following code:
{code:title=Client.java|borderStyle=solid}
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());
}
{code}
batch will be a field of anonymous inner classes.don't release after channel.write() invoked,until IO operation complete.
> Netty Client hold batch object until io operation complete
> ----------------------------------------------------------
>
> Key: STORM-835
> URL: https://issues.apache.org/jira/browse/STORM-835
> Project: Apache Storm
> Issue Type: Improvement
> Affects Versions: 0.10.0
> Reporter: zhanghailei
> Priority: Minor
>
> Netty Client hold batch object until IO operation complete.
> Following code:
> {code:title=Client.java|borderStyle=solid}
> 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());
> }
> {code}
> batch will be a field of anonymous inner classes.don't release after channel.write() invoked,until IO operation complete.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)