You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/04/20 16:49:31 UTC
[2/4] git commit: CAMEL-7379 fixed the issue of allChannels should
not be static variable for the NettyProducer
CAMEL-7379 fixed the issue of allChannels should not be static variable for the NettyProducer
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a44fad58
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a44fad58
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a44fad58
Branch: refs/heads/camel-2.13.x
Commit: a44fad58177e825a298ee1470e299b6daa9b751b
Parents: 4a2ed1d
Author: Willem Jiang <wi...@gmail.com>
Authored: Sun Apr 20 22:39:59 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sun Apr 20 22:48:18 2014 +0800
----------------------------------------------------------------------
.../apache/camel/component/netty/NettyProducer.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a44fad58/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
index 1b0a7a7..9e318d3 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
@@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory;
public class NettyProducer extends DefaultAsyncProducer {
private static final Logger LOG = LoggerFactory.getLogger(NettyProducer.class);
- private static final ChannelGroup ALL_CHANNELS = new DefaultChannelGroup("NettyProducer");
+ private final ChannelGroup allChannels = new DefaultChannelGroup("NettyProducer");
private CamelContext context;
private NettyConfiguration configuration;
private ChannelFactory channelFactory;
@@ -148,8 +148,8 @@ public class NettyProducer extends DefaultAsyncProducer {
protected void doStop() throws Exception {
LOG.debug("Stopping producer at address: {}", configuration.getAddress());
// close all channels
- LOG.trace("Closing {} channels", ALL_CHANNELS.size());
- ChannelGroupFuture future = ALL_CHANNELS.close();
+ LOG.trace("Closing {} channels", allChannels.size());
+ ChannelGroupFuture future = allChannels.close();
future.awaitUninterruptibly();
// and then release other resources
@@ -400,7 +400,7 @@ public class NettyProducer extends DefaultAsyncProducer {
connectionlessClientBootstrap.setPipelineFactory(pipelineFactory);
// bind and store channel so we can close it when stopping
Channel channel = connectionlessClientBootstrap.bind(new InetSocketAddress(0));
- ALL_CHANNELS.add(channel);
+ allChannels.add(channel);
answer = connectionlessClientBootstrap.connect(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
if (LOG.isDebugEnabled()) {
@@ -442,7 +442,7 @@ public class NettyProducer extends DefaultAsyncProducer {
}
Channel answer = channelFuture.getChannel();
// to keep track of all channels in use
- ALL_CHANNELS.add(answer);
+ allChannels.add(answer);
if (LOG.isDebugEnabled()) {
LOG.debug("Creating connector to address: {}", configuration.getAddress());
@@ -467,7 +467,7 @@ public class NettyProducer extends DefaultAsyncProducer {
}
public ChannelGroup getAllChannels() {
- return ALL_CHANNELS;
+ return allChannels;
}
/**
@@ -515,7 +515,7 @@ public class NettyProducer extends DefaultAsyncProducer {
public void destroyObject(Channel channel) throws Exception {
LOG.trace("Destroying channel: {}", channel);
NettyHelper.close(channel);
- ALL_CHANNELS.remove(channel);
+ allChannels.remove(channel);
}
@Override