camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/2] git commit: CAMEL-7379 fixed the issue of allChannels should not be static variable for the NettyProducer
Date Sun, 20 Apr 2014 14:41:47 GMT
Repository: camel
Updated Branches:
  refs/heads/master 44b522a4c -> 314f6bbe5


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/314f6bbe
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/314f6bbe
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/314f6bbe

Branch: refs/heads/master
Commit: 314f6bbe5994323928bc7b01838d1bc9d58d46e5
Parents: 5b6fbf0
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Sun Apr 20 22:39:59 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Sun Apr 20 22:40:19 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/314f6bbe/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


Mime
View raw message