You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2015/01/23 23:38:15 UTC

qpid-jms git commit: Limit the group to one thread as that's all we need for a single transport instance. Request a fast shutdown as we've closed the channel and marked the transport as closed only internal tasks would be finishing now.

Repository: qpid-jms
Updated Branches:
  refs/heads/master 49b3b1baa -> 016343439


Limit the group to one thread as that's all we need for a single
transport instance.  Request a fast shutdown as we've closed the channel
and marked the transport as closed only internal tasks would be
finishing now.  

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/01634343
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/01634343
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/01634343

Branch: refs/heads/master
Commit: 01634343933f96c50fe2d22d653e6b4a7c21da65
Parents: 49b3b1b
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jan 23 17:38:08 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jan 23 17:38:08 2015 -0500

----------------------------------------------------------------------
 .../apache/qpid/jms/transports/netty/NettyTcpTransport.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/01634343/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java
index 3fab4b6..ac86a3f 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java
@@ -33,6 +33,7 @@ import io.netty.channel.socket.nio.NioSocketChannel;
 import java.io.IOException;
 import java.net.URI;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.qpid.jms.transports.Transport;
@@ -50,6 +51,9 @@ public class NettyTcpTransport implements Transport {
 
     private static final Logger LOG = LoggerFactory.getLogger(NettyTcpTransport.class);
 
+    private static final int QUIET_PERIOD = 20;
+    private static final int SHUTDOWN_TIMEOUT = 100;
+
     protected Bootstrap bootstrap;
     protected EventLoopGroup group;
     protected Channel channel;
@@ -97,7 +101,7 @@ public class NettyTcpTransport implements Transport {
             throw new IllegalStateException("A transport listener must be set before connection attempts.");
         }
 
-        group = new NioEventLoopGroup();
+        group = new NioEventLoopGroup(1);
 
         bootstrap = new Bootstrap();
         bootstrap.group(group);
@@ -153,7 +157,7 @@ public class NettyTcpTransport implements Transport {
                 channel.close().syncUninterruptibly();
             }
             if (group != null) {
-                group.shutdownGracefully();
+                group.shutdownGracefully(QUIET_PERIOD, SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS);
             }
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org