hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1393752 - in /httpcomponents/httpcore/trunk/httpcore-nio/src: examples/org/apache/http/examples/nio/ main/java/org/apache/http/impl/nio/ main/java/org/apache/http/impl/nio/pool/ test/java/org/apache/http/impl/nio/pool/ test/java/org/apache...
Date Wed, 03 Oct 2012 20:40:03 GMT
Author: olegk
Date: Wed Oct  3 20:40:02 2012
New Revision: 1393752

URL: http://svn.apache.org/viewvc?rev=1393752&view=rev
Log:
Configuration API changes: basic non-blocking connection pool implementation is no longer
dependent on HttpParams

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpCoreNIOTestBase.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
Wed Oct  3 20:40:02 2012
@@ -29,6 +29,7 @@ package org.apache.http.examples.nio;
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequestInterceptor;
@@ -79,11 +80,11 @@ public class NHttpClient {
         // Create client-side HTTP protocol handler
         HttpAsyncRequestExecutor protocolHandler = new HttpAsyncRequestExecutor();
         // Create client-side I/O event dispatch
-        final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler,
params);
+        final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler);
         // Create client-side I/O reactor
         final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
         // Create HTTP connection pool
-        BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor, params);
+        BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor, 3, TimeUnit.SECONDS);
         // Limit total number of connections to just two
         pool.setDefaultMaxPerRoute(2);
         pool.setMaxTotal(2);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
Wed Oct  3 20:40:02 2012
@@ -32,6 +32,7 @@ import java.net.InetSocketAddress;
 import java.net.URI;
 import java.nio.ByteBuffer;
 import java.util.Locale;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.http.ConnectionReuseStrategy;
@@ -156,7 +157,7 @@ public class NHttpReverseProxy {
         HttpAsyncRequester executor = new HttpAsyncRequester(
                 outhttpproc, new ProxyOutgoingConnectionReuseStrategy(), params);
 
-        ProxyConnPool connPool = new ProxyConnPool(connectingIOReactor, params);
+        ProxyConnPool connPool = new ProxyConnPool(connectingIOReactor, 3, TimeUnit.SECONDS);
         connPool.setMaxTotal(100);
         connPool.setDefaultMaxPerRoute(20);
 
@@ -167,10 +168,10 @@ public class NHttpReverseProxy {
                 inhttpproc, new ProxyIncomingConnectionReuseStrategy(), handlerRegistry,
params);
 
         final IOEventDispatch connectingEventDispatch = new DefaultHttpClientIODispatch(
-                clientHandler, params);
+                clientHandler);
 
         final IOEventDispatch listeningEventDispatch = new DefaultHttpServerIODispatch(
-                serviceHandler, params);
+                serviceHandler);
 
         Thread t = new Thread(new Runnable() {
 
@@ -847,15 +848,16 @@ public class NHttpReverseProxy {
 
     static class ProxyConnPool extends BasicNIOConnPool {
 
-        public ProxyConnPool(final ConnectingIOReactor ioreactor, final HttpParams params)
{
-            super(ioreactor, params);
+        public ProxyConnPool(final ConnectingIOReactor ioreactor,
+                int connectTimeout, final TimeUnit tunit) {
+            super(ioreactor, connectTimeout, tunit);
         }
 
         public ProxyConnPool(
                 final ConnectingIOReactor ioreactor,
                 final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
-                final HttpParams params) {
-            super(ioreactor, connFactory, params);
+                int connectTimeout, final TimeUnit tunit) {
+            super(ioreactor, connFactory, connectTimeout, tunit);
         }
 
         @Override

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
Wed Oct  3 20:40:02 2012
@@ -69,12 +69,22 @@ public class DefaultHttpClientIODispatch
         this.connFactory = Args.notNull(connFactory, "HTTP client connection factory");
     }
 
+    /**
+     * @deprecated (4.3) use {@link DefaultHttpClientIODispatch#DefaultHttpClientIODispatch(
+     *   NHttpClientEventHandler)}
+     */
+    @Deprecated
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
             final HttpParams params) {
         this(handler, new DefaultNHttpClientConnectionFactory(params));
     }
 
+    /**
+     * @deprecated (4.3) use {@link DefaultHttpClientIODispatch#DefaultHttpClientIODispatch(
+     *   NHttpClientEventHandler, SSLContext, SSLSetupHandler)}
+     */
+    @Deprecated
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
             final SSLContext sslcontext,
@@ -83,6 +93,11 @@ public class DefaultHttpClientIODispatch
         this(handler, new SSLNHttpClientConnectionFactory(sslcontext, sslHandler, params));
     }
 
+    /**
+     * @deprecated (4.3) use {@link DefaultHttpClientIODispatch#DefaultHttpClientIODispatch(
+     *   NHttpClientEventHandler, SSLContext)}
+     */
+    @Deprecated
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
             final SSLContext sslcontext,
@@ -90,6 +105,32 @@ public class DefaultHttpClientIODispatch
         this(handler, sslcontext, null, params);
     }
 
+    /**
+     * @since 4.3
+     */
+    public DefaultHttpClientIODispatch(final NHttpClientEventHandler handler) {
+        this(handler, new DefaultNHttpClientConnectionFactory());
+    }
+
+    /**
+     * @since 4.3
+     */
+    public DefaultHttpClientIODispatch(
+            final NHttpClientEventHandler handler,
+            final SSLContext sslcontext,
+            final SSLSetupHandler sslHandler) {
+        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, sslHandler));
+    }
+
+    /**
+     * @since 4.3
+     */
+    public DefaultHttpClientIODispatch(
+            final NHttpClientEventHandler handler,
+            final SSLContext sslcontext) {
+        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, null));
+    }
+
     @Override
     protected DefaultNHttpClientConnection createConnection(final IOSession session) {
         return this.connFactory.createConnection(session);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
Wed Oct  3 20:40:02 2012
@@ -62,12 +62,22 @@ public class DefaultHttpServerIODispatch
         this.connFactory = Args.notNull(connFactory, "HTTP server connection factory");
     }
 
+    /**
+     * @deprecated (4.3) use {@link DefaultHttpServerIODispatch#DefaultHttpServerIODispatch(
+     *   NHttpServerEventHandler)}
+     */
+    @Deprecated
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
             final HttpParams params) {
         this(handler, new DefaultNHttpServerConnectionFactory(params));
     }
 
+    /**
+     * @deprecated (4.3) use {@link DefaultHttpServerIODispatch#DefaultHttpServerIODispatch(
+     *   NHttpServerEventHandler, SSLContext, SSLSetupHandler)}
+     */
+    @Deprecated
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
             final SSLContext sslcontext,
@@ -76,6 +86,11 @@ public class DefaultHttpServerIODispatch
         this(handler, new SSLNHttpServerConnectionFactory(sslcontext, sslHandler, params));
     }
 
+    /**
+     * @deprecated (4.3) use {@link DefaultHttpServerIODispatch#DefaultHttpServerIODispatch(
+     *   NHttpServerEventHandler, SSLContext)}
+     */
+    @Deprecated
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
             final SSLContext sslcontext,
@@ -83,6 +98,32 @@ public class DefaultHttpServerIODispatch
         this(handler, sslcontext, null, params);
     }
 
+    /**
+     * @since 4.3
+     */
+    public DefaultHttpServerIODispatch(final NHttpServerEventHandler handler) {
+        this(handler, new DefaultNHttpServerConnectionFactory());
+    }
+
+    /**
+     * @since 4.3
+     */
+    public DefaultHttpServerIODispatch(
+            final NHttpServerEventHandler handler,
+            final SSLContext sslcontext,
+            final SSLSetupHandler sslHandler) {
+        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, sslHandler));
+    }
+
+    /**
+     * @since 4.3
+     */
+    public DefaultHttpServerIODispatch(
+            final NHttpServerEventHandler handler,
+            final SSLContext sslcontext) {
+        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, null));
+    }
+
     @Override
     protected DefaultNHttpServerConnection createConnection(final IOSession session) {
         return this.connFactory.createConnection(session);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnectionFactory.java
Wed Oct  3 20:40:02 2012
@@ -59,7 +59,7 @@ public class DefaultNHttpClientConnectio
     /**
      * @deprecated (4.3) use {@link
      *   DefaultNHttpClientConnectionFactory#DefaultNHttpClientConnectionFactory(
-     *     ByteBufferAllocator, HttpResponseFactory)}
+     *     HttpResponseFactory, ByteBufferAllocator)}
      */
     @Deprecated
     public DefaultNHttpClientConnectionFactory(
@@ -89,8 +89,8 @@ public class DefaultNHttpClientConnectio
      * @since 4.3
      */
     public DefaultNHttpClientConnectionFactory(
-            final ByteBufferAllocator allocator,
-            final HttpResponseFactory responseFactory) {
+            final HttpResponseFactory responseFactory,
+            final ByteBufferAllocator allocator) {
         super();
         this.responseFactory = responseFactory;
         this.allocator = allocator;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnectionFactory.java
Wed Oct  3 20:40:02 2012
@@ -28,7 +28,6 @@ package org.apache.http.impl.nio;
 
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestFactory;
-import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.impl.DefaultHttpRequestFactory;
 import org.apache.http.impl.nio.codecs.DefaultHttpRequestParserFactory;
@@ -59,8 +58,8 @@ public class DefaultNHttpServerConnectio
 
     /**
      * @deprecated (4.3) use {@link
-     *   DefaultNHttpClientConnectionFactory#DefaultNHttpClientConnectionFactory(
-     *     ByteBufferAllocator, HttpResponseFactory)}
+     *   DefaultNHttpServerConnectionFactory#DefaultNHttpServerConnectionFactory(
+     *     ByteBufferAllocator, HttpRequestFactory)}
      */
     @Deprecated
     public DefaultNHttpServerConnectionFactory(
@@ -79,8 +78,7 @@ public class DefaultNHttpServerConnectio
 
     /**
      * @deprecated (4.3) use {@link
-     *   DefaultNHttpClientConnectionFactory#DefaultNHttpClientConnectionFactory(
-     *     ByteBufferAllocator, HttpResponseFactory)}
+     *   DefaultNHttpServerConnectionFactory#DefaultNHttpServerConnectionFactory()}
      */
     @Deprecated
     public DefaultNHttpServerConnectionFactory(final HttpParams params) {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
Wed Oct  3 20:40:02 2012
@@ -33,6 +33,7 @@ import org.apache.http.HttpResponseFacto
 import org.apache.http.annotation.Immutable;
 import org.apache.http.impl.DefaultHttpResponseFactory;
 import org.apache.http.impl.nio.codecs.DefaultHttpResponseParserFactory;
+import org.apache.http.message.BasicLineParser;
 import org.apache.http.nio.NHttpClientConnection;
 import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.NHttpMessageParserFactory;
@@ -122,8 +123,10 @@ public class SSLNHttpClientConnectionFac
         this.sslcontext = sslcontext;
         this.sslHandler = sslHandler;
         this.responseFactory = responseFactory;
-        this.allocator = allocator;
-        this.responseParserFactory = new DefaultHttpResponseParserFactory(null, responseFactory);
+        this.allocator = allocator != null ? allocator : HeapByteBufferAllocator.INSTANCE;
+        this.responseParserFactory = new DefaultHttpResponseParserFactory(
+                BasicLineParser.INSTANCE,
+                responseFactory != null ? responseFactory : DefaultHttpResponseFactory.INSTANCE);
         this.params = null;
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
Wed Oct  3 20:40:02 2012
@@ -30,7 +30,6 @@ import javax.net.ssl.SSLContext;
 
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestFactory;
-import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.impl.DefaultHttpRequestFactory;
 import org.apache.http.impl.nio.codecs.DefaultHttpRequestParserFactory;
@@ -66,8 +65,8 @@ public class SSLNHttpServerConnectionFac
 
     /**
      * @deprecated (4.3) use {@link
-     *   DefaultNHttpClientConnectionFactory#DefaultNHttpClientConnectionFactory(
-     *     ByteBufferAllocator, HttpResponseFactory)}
+     *   SSLNHttpServerConnectionFactory#SSLNHttpServerConnectionFactory(SSLContext,
+     *     SSLSetupHandler, HttpRequestFactory, ByteBufferAllocator)}
      */
     @Deprecated
     public SSLNHttpServerConnectionFactory(
@@ -90,8 +89,8 @@ public class SSLNHttpServerConnectionFac
 
     /**
      * @deprecated (4.3) use {@link
-     *   DefaultNHttpClientConnectionFactory#DefaultNHttpClientConnectionFactory(
-     *     ByteBufferAllocator, HttpResponseFactory)}
+     *   SSLNHttpServerConnectionFactory#SSLNHttpServerConnectionFactory(SSLContext,
+     *     SSLSetupHandler)}
      */
     @Deprecated
     public SSLNHttpServerConnectionFactory(
@@ -104,8 +103,7 @@ public class SSLNHttpServerConnectionFac
 
     /**
      * @deprecated (4.3) use {@link
-     *   DefaultNHttpClientConnectionFactory#DefaultNHttpClientConnectionFactory(
-     *     ByteBufferAllocator, HttpResponseFactory)}
+     *   SSLNHttpServerConnectionFactory#SSLNHttpServerConnectionFactory()}
      */
     @Deprecated
     public SSLNHttpServerConnectionFactory(final HttpParams params) {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
Wed Oct  3 20:40:02 2012
@@ -50,15 +50,6 @@ import org.apache.http.util.Args;
 /**
  * A basic {@link NIOConnFactory} implementation that creates
  * {@link NHttpClientConnection} instances given a {@link HttpHost} instance.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SOCKET_BUFFER_SIZE}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_HEADER_COUNT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
- * </ul>
  *
  * @since 4.2
  */
@@ -82,6 +73,11 @@ public class BasicNIOConnFactory impleme
         this(plainFactory, null);
     }
 
+    /**
+     * @deprecated (4.3) use {@link BasicNIOConnFactory#BasicNIOConnFactory(SSLContext,
+     *   SSLSetupHandler, HttpResponseFactory, ByteBufferAllocator)}
+     */
+    @Deprecated
     public BasicNIOConnFactory(
             final SSLContext sslcontext,
             final SSLSetupHandler sslHandler,
@@ -94,6 +90,10 @@ public class BasicNIOConnFactory impleme
                         sslcontext, sslHandler, responseFactory, allocator, params));
     }
 
+    /**
+     * @deprecated (4.3) use {@link BasicNIOConnFactory#BasicNIOConnFactory(SSLContext,
+     *   SSLSetupHandler)}
+     */
     public BasicNIOConnFactory(
             final SSLContext sslcontext,
             final SSLSetupHandler sslHandler,
@@ -102,10 +102,42 @@ public class BasicNIOConnFactory impleme
                 DefaultHttpResponseFactory.INSTANCE, HeapByteBufferAllocator.INSTANCE, params);
     }
 
+    /**
+     * @deprecated (4.3) use {@link BasicNIOConnFactory#BasicNIOConnFactory()}
+     */
     public BasicNIOConnFactory(final HttpParams params) {
         this(null, null, params);
     }
 
+    /**
+     * @since 4.3
+     */
+    public BasicNIOConnFactory(
+            final SSLContext sslcontext,
+            final SSLSetupHandler sslHandler,
+            final HttpResponseFactory responseFactory,
+            final ByteBufferAllocator allocator) {
+        this(new DefaultNHttpClientConnectionFactory(responseFactory, allocator),
+                new SSLNHttpClientConnectionFactory(sslcontext, sslHandler, responseFactory,
+                        allocator));
+    }
+
+    /**
+     * @since 4.3
+     */
+    public BasicNIOConnFactory(
+            final SSLContext sslcontext,
+            final SSLSetupHandler sslHandler) {
+        this(sslcontext, sslHandler, null, null);
+    }
+
+    /**
+     * @since 4.3
+     */
+    public BasicNIOConnFactory() {
+        this(new DefaultNHttpClientConnectionFactory(null, null), null);
+    }
+
     public NHttpClientConnection create(final HttpHost route, final IOSession session) throws
IOException {
         NHttpClientConnection conn;
         if (route.getSchemeName().equalsIgnoreCase("https")) {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
Wed Oct  3 20:40:02 2012
@@ -51,17 +51,6 @@ import org.apache.http.util.Args;
  * an {@link HttpHost} instance. Please note this pool implementation
  * does not support complex routes via a proxy cannot differentiate between
  * direct and proxied connections.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SO_TIMEOUT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#CONNECTION_TIMEOUT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SOCKET_BUFFER_SIZE}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_HEADER_COUNT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
- * </ul>
  *
  * @see HttpHost
  * @since 4.2
@@ -71,22 +60,71 @@ public class BasicNIOConnPool extends Ab
 
     private static AtomicLong COUNTER = new AtomicLong();
 
-    private final HttpParams params;
+    private final int connectTimeout;
+    private final TimeUnit tunit;
 
+    /**
+     * @deprecated (4.3) use {@link BasicNIOConnPool#BasicNIOConnPool(ConnectingIOReactor,
+     *   NIOConnFactory, int, TimeUnit)}
+     */
+    @Deprecated
     public BasicNIOConnPool(
             final ConnectingIOReactor ioreactor,
             final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
             final HttpParams params) {
         super(ioreactor, connFactory, 2, 20);
         Args.notNull(params, "HTTP parameters");
-        this.params = params;
+        this.connectTimeout = Config.getInt(params, CoreConnectionPNames.CONNECTION_TIMEOUT,
0);
+        this.tunit = TimeUnit.MILLISECONDS;
     }
 
+    /**
+     * @deprecated (4.3) use {@link BasicNIOConnPool#BasicNIOConnPool(ConnectingIOReactor,
+     *   int, TimeUnit)}
+     */
+    @Deprecated
     public BasicNIOConnPool(
             final ConnectingIOReactor ioreactor, final HttpParams params) {
         this(ioreactor, new BasicNIOConnFactory(params), params);
     }
 
+    /**
+     * @since 4.3
+     */
+    public BasicNIOConnPool(
+            final ConnectingIOReactor ioreactor,
+            final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
+            int connectTimeout,
+            final TimeUnit tunit) {
+        super(ioreactor, connFactory, 2, 20);
+        this.connectTimeout = connectTimeout;
+        this.tunit = tunit != null ? tunit : TimeUnit.MILLISECONDS;
+    }
+
+    /**
+     * @since 4.3
+     */
+    public BasicNIOConnPool(
+            final ConnectingIOReactor ioreactor,
+            final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory) {
+        this(ioreactor, connFactory, 0, TimeUnit.MILLISECONDS);
+    }
+
+    /**
+     * @since 4.3
+     */
+    public BasicNIOConnPool(
+            final ConnectingIOReactor ioreactor, int connectTimeout, final TimeUnit tunit)
{
+        this(ioreactor, new BasicNIOConnFactory(), connectTimeout, tunit);
+    }
+
+    /**
+     * @since 4.3
+     */
+    public BasicNIOConnPool(final ConnectingIOReactor ioreactor) {
+        this(ioreactor, new BasicNIOConnFactory(), 0, TimeUnit.MILLISECONDS);
+    }
+
     @Override
     protected SocketAddress resolveRemoteAddress(final HttpHost host) {
         return new InetSocketAddress(host.getHostName(), host.getPort());
@@ -107,16 +145,14 @@ public class BasicNIOConnPool extends Ab
             final HttpHost route,
             final Object state,
             final FutureCallback<BasicNIOPoolEntry> callback) {
-        int connectTimeout = Config.getInt(params, CoreConnectionPNames.CONNECTION_TIMEOUT,
0);
-        return super.lease(route, state, connectTimeout, TimeUnit.MILLISECONDS, callback);
+        return super.lease(route, state, this.connectTimeout, this.tunit, callback);
     }
 
     @Override
     public Future<BasicNIOPoolEntry> lease(
             final HttpHost route,
             final Object state) {
-        int connectTimeout = Config.getInt(params, CoreConnectionPNames.CONNECTION_TIMEOUT,
0);
-        return super.lease(route, state, connectTimeout, TimeUnit.MILLISECONDS, null);
+        return super.lease(route, state, this.connectTimeout, this.tunit, null);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
Wed Oct  3 20:40:02 2012
@@ -30,8 +30,6 @@ import org.apache.http.HttpHost;
 import org.apache.http.nio.NHttpClientConnection;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOSession;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpParams;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -40,7 +38,6 @@ import org.mockito.MockitoAnnotations;
 
 public class TestBasicNIOConnPool {
 
-    private HttpParams params;
     private BasicNIOConnFactory connFactory;
     private BasicNIOConnPool pool;
     private HttpHost route;
@@ -52,9 +49,8 @@ public class TestBasicNIOConnPool {
         MockitoAnnotations.initMocks(this);
 
         route = new HttpHost("localhost", 80, "http");
-        params = new BasicHttpParams();
-        connFactory = new BasicNIOConnFactory(params);
-        pool = new BasicNIOConnPool(reactor, connFactory, params);
+        connFactory = new BasicNIOConnFactory();
+        pool = new BasicNIOConnPool(reactor, connFactory);
     }
 
     @After
@@ -63,12 +59,7 @@ public class TestBasicNIOConnPool {
 
     @Test(expected=IllegalArgumentException.class)
     public void testNullConstructor() throws Exception {
-        pool = new BasicNIOConnPool(null, new BasicHttpParams());
-    }
-
-    @Test(expected=IllegalArgumentException.class)
-    public void testNullConstructor2() throws Exception {
-        pool = new BasicNIOConnPool(reactor, null);
+        pool = new BasicNIOConnPool(null);
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
Wed Oct  3 20:40:02 2012
@@ -73,7 +73,7 @@ public class TestDefaultListeningIOReact
                 DefaultConnectionReuseStrategy.INSTANCE,
                 new UriHttpAsyncRequestHandlerMapper(),
                 params);
-        return new DefaultHttpServerIODispatch(serviceHandler, params);
+        return new DefaultHttpServerIODispatch(serviceHandler);
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpCoreNIOTestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpCoreNIOTestBase.java?rev=1393752&r1=1393751&r2=1393752&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpCoreNIOTestBase.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpCoreNIOTestBase.java
Wed Oct  3 20:40:02 2012
@@ -108,8 +108,7 @@ public abstract class HttpCoreNIOTestBas
     public void initConnPool() throws Exception {
         this.connpool = new BasicNIOConnPool(
                 this.client.getIoReactor(),
-                new BasicNIOConnFactory(createClientConnectionFactory()),
-                this.clientParams);
+                new BasicNIOConnFactory(createClientConnectionFactory()));
         this.executor = new HttpAsyncRequester(
                 this.clientHttpProc,
                 DefaultConnectionReuseStrategy.INSTANCE,



Mime
View raw message