cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1560337 - in /cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client: NettyHttpConduit.java NettyHttpConduitFactory.java
Date Wed, 22 Jan 2014 12:39:28 GMT
Author: ningjiang
Date: Wed Jan 22 12:39:28 2014
New Revision: 1560337

URL: http://svn.apache.org/r1560337
Log:
CXF-5511 Moved the EventLoopGroup to NettyHttpConduitFactory

Modified:
    cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
    cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitFactory.java

Modified: cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java?rev=1560337&r1=1560336&r2=1560337&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
(original)
+++ cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
Wed Jan 22 12:39:28 2014
@@ -63,8 +63,6 @@ import io.netty.buffer.Unpooled;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelFutureListener;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.socket.nio.NioSocketChannel;
 import io.netty.handler.codec.http.HttpContent;
 import io.netty.handler.codec.http.HttpResponse;
@@ -75,16 +73,14 @@ public class NettyHttpConduit extends UR
     public static final String USE_ASYNC = "use.async.http.conduit";
     final NettyHttpConduitFactory factory;
     private Bootstrap bootstrap;
-    // TODO do we need to use the EventLoop from NettyHttpConduitFactory
-    private final EventLoopGroup group;
+    
     
     public NettyHttpConduit(Bus b, EndpointInfo ei, EndpointReferenceType t, NettyHttpConduitFactory
conduitFactory)
         throws IOException {
         super(b, ei, t);
         factory = conduitFactory;
-        group = new NioEventLoopGroup();
         bootstrap = new Bootstrap();
-        bootstrap.group(group);
+        bootstrap.group(factory.getEventLoopGroup());
         bootstrap.channel(NioSocketChannel.class);
     }
     
@@ -92,12 +88,6 @@ public class NettyHttpConduit extends UR
         return factory;
     }
     
-    public void close() {
-        super.close();
-        // clean up thread of the group
-        group.shutdownGracefully().syncUninterruptibly();
-    }
-
     // Using Netty API directly
     protected void setupConnection(Message message, URI uri, HTTPClientPolicy csPolicy) throws
IOException {
         // need to do some clean up work on the URI address

Modified: cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitFactory.java?rev=1560337&r1=1560336&r2=1560337&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitFactory.java
(original)
+++ cxf/trunk/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitFactory.java
Wed Jan 22 12:39:28 2014
@@ -20,6 +20,7 @@
 package org.apache.cxf.transport.http.netty.client;
 
 import java.io.IOException;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.buslifecycle.BusLifeCycleListener;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
@@ -29,12 +30,19 @@ import org.apache.cxf.transport.http.HTT
 import org.apache.cxf.transport.http.HTTPTransportFactory;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+
+
 @NoJSR250Annotations
 public class NettyHttpConduitFactory implements BusLifeCycleListener, HTTPConduitFactory
{
 
     boolean isShutdown;
+    
+    final EventLoopGroup eventLoopGroup; 
 
     public NettyHttpConduitFactory() {
+        eventLoopGroup = new NioEventLoopGroup();
     }
 
     @Override
@@ -66,12 +74,15 @@ public class NettyHttpConduitFactory imp
 
     @Override
     public void postShutdown() {
-        // shutdown the group
-        
+        eventLoopGroup.shutdownGracefully().syncUninterruptibly();
     }
 
     public boolean isShutdown() {
         return isShutdown;
     }
+    
+    public EventLoopGroup getEventLoopGroup() {
+        return eventLoopGroup;
+    }
 
 }



Mime
View raw message