hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1157038 [1/2] - in /httpcomponents/httpcore/trunk: httpcore-nio/src/examples/org/apache/http/examples/nio/ httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/ httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ httpcore-nio/...
Date Fri, 12 Aug 2011 10:35:33 GMT
Author: olegk
Date: Fri Aug 12 10:35:32 2011
New Revision: 1157038

URL: http://svn.apache.org/viewvc?rev=1157038&view=rev
Log:
Replaced HttpParams with IOReactorConfig java bean as a configuration mechanism for I/O reactors; deprecated NIOReactorPNames and related classes; deprecated throttling protocol handlers

Added:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java   (with props)
Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java
    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/examples/org/apache/http/examples/nio/NHttpSSLClient.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOPoolEntry.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParamBean.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.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/nio/protocol/TestThrottlingNHttpHandlers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpClientNio.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpSSLClient.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpSSLServer.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/testserver/HttpServerNio.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java Fri Aug 12 10:35:32 2011
@@ -31,20 +31,17 @@ import java.io.InterruptedIOException;
 import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 
-import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor;
 import org.apache.http.nio.reactor.EventMask;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.reactor.ListeningIOReactor;
-import org.apache.http.params.HttpParams;
 
 public class ElementalEchoServer {
 
     public static void main(String[] args) throws Exception {
-        HttpParams params = new SyncBasicHttpParams(); 
         IOEventDispatch ioEventDispatch = new DefaultIoEventDispatch();
-        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
+        ListeningIOReactor ioReactor = new DefaultListeningIOReactor();
         ioReactor.listen(new InetSocketAddress(8080));
         try {
             ioReactor.execute(ioEventDispatch);
@@ -55,11 +52,11 @@ public class ElementalEchoServer {
         }
         System.out.println("Shutdown");
     }
-    
+
     static class DefaultIoEventDispatch implements IOEventDispatch {
 
         private final ByteBuffer buffer = ByteBuffer.allocate(1024);
-        
+
         public void connected(IOSession session) {
             System.out.println("connected");
             session.setEventMask(EventMask.READ);
@@ -101,10 +98,10 @@ public class ElementalEchoServer {
             System.out.println("timeout");
             session.close();
         }
-        
+
         public void disconnected(final IOSession session) {
             System.out.println("disconnected");
         }
     }
-    
+
 }

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=1157038&r1=1157037&r2=1157038&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 Fri Aug 12 10:35:32 2011
@@ -28,6 +28,7 @@ package org.apache.http.examples.nio;
 
 import java.io.IOException;
 import java.io.InterruptedIOException;
+import java.nio.channels.SelectionKey;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -42,11 +43,11 @@ import org.apache.http.impl.nio.pool.Bas
 import org.apache.http.impl.nio.pool.BasicNIOPoolEntry;
 import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.protocol.BufferingHttpClientHandler;
 import org.apache.http.nio.protocol.HttpRequestExecutionHandler;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.CoreProtocolPNames;
 import org.apache.http.params.HttpParams;
@@ -69,6 +70,7 @@ import org.apache.http.protocol.RequestU
 public class NHttpClient {
 
     public static void main(String[] args) throws Exception {
+        final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
         HttpParams params = new SyncBasicHttpParams();
         params
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
@@ -78,9 +80,8 @@ public class NHttpClient {
             .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
             .setParameter(CoreProtocolPNames.USER_AGENT, "Test/1.1");
 
-        final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(2, params);
 
-        BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor, params);
+        BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor);
         // Limit total number of connections to just two
         pool.setDefaultMaxPerRoute(2);
         pool.setMaxTotal(2);
@@ -166,9 +167,9 @@ public class NHttpClient {
 
         public void completed(final BasicNIOPoolEntry entry) {
             this.poolEntry = entry;
-            NHttpConnection conn = entry.getConnection();
-            conn.getContext().setAttribute("executor", this);
-            conn.requestOutput();
+            IOSession session = entry.getConnection();
+            session.setAttribute("executor", this);
+            session.setEvent(SelectionKey.OP_WRITE);
             System.out.println(this.poolEntry.getRoute() + ": obtained connection from the pool");
         }
 

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=1157038&r1=1157037&r2=1157038&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 Fri Aug 12 10:35:32 2011
@@ -50,6 +50,7 @@ import org.apache.http.impl.nio.DefaultC
 import org.apache.http.impl.nio.DefaultServerIOEventDispatch;
 import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
 import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor;
+import org.apache.http.impl.nio.reactor.IOReactorConfig;
 import org.apache.http.nio.ContentDecoder;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
@@ -85,14 +86,14 @@ import org.apache.http.protocol.Response
  * Rudimentary HTTP/1.1 reverse proxy based on the non-blocking I/O model.
  * <p>
  * Please note the purpose of this application is demonstrate the usage of HttpCore APIs.
- * It is NOT intended to demonstrate the most efficient way of building an HTTP reverse proxy. 
- * 
+ * It is NOT intended to demonstrate the most efficient way of building an HTTP reverse proxy.
+ *
  *
  */
 public class NHttpReverseProxy {
 
     public static void main(String[] args) throws Exception {
-        
+
         if (args.length < 1) {
             System.out.println("Usage: NHttpReverseProxy <hostname> [port]");
             System.exit(1);
@@ -102,25 +103,24 @@ public class NHttpReverseProxy {
         if (args.length > 1) {
             port = Integer.parseInt(args[1]);
         }
-        
+
         // Target host
-        HttpHost targetHost = new HttpHost(hostname, port); 
-        
+        HttpHost targetHost = new HttpHost(hostname, port);
+
         HttpParams params = new SyncBasicHttpParams();
         params
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 30000)
             .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
             .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
             .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
-            .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1")
-            .setParameter(CoreProtocolPNames.USER_AGENT, "HttpComponents/1.1");
+            .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "Test/1.1")
+            .setParameter(CoreProtocolPNames.USER_AGENT, "Test/1.1");
 
-        final ConnectingIOReactor connectingIOReactor = new DefaultConnectingIOReactor(
-                1, params);
+        IOReactorConfig config = new IOReactorConfig();
+        config.setIoThreadCount(1);
+        final ConnectingIOReactor connectingIOReactor = new DefaultConnectingIOReactor(config);
+        final ListeningIOReactor listeningIOReactor = new DefaultListeningIOReactor(config);
 
-        final ListeningIOReactor listeningIOReactor = new DefaultListeningIOReactor(
-                1, params);
-        
         // Set up HTTP protocol processor for incoming connections
         HttpProcessor inhttpproc = new ImmutableHttpProcessor(
                 new HttpRequestInterceptor[] {
@@ -130,7 +130,7 @@ public class NHttpReverseProxy {
                         new RequestUserAgent(),
                         new RequestExpectContinue()
          });
-        
+
         // Set up HTTP protocol processor for outgoing connections
         HttpProcessor outhttpproc = new ImmutableHttpProcessor(
                 new HttpResponseInterceptor[] {
@@ -139,7 +139,7 @@ public class NHttpReverseProxy {
                         new ResponseContent(),
                         new ResponseConnControl()
         });
-        
+
         NHttpClientHandler connectingHandler = new ConnectingHandler(
                 inhttpproc,
                 new DefaultConnectionReuseStrategy(),
@@ -148,19 +148,19 @@ public class NHttpReverseProxy {
         NHttpServiceHandler listeningHandler = new ListeningHandler(
                 targetHost,
                 connectingIOReactor,
-                outhttpproc, 
+                outhttpproc,
                 new DefaultHttpResponseFactory(),
                 new DefaultConnectionReuseStrategy(),
                 params);
-        
+
         final IOEventDispatch connectingEventDispatch = new DefaultClientIOEventDispatch(
                 connectingHandler, params);
 
         final IOEventDispatch listeningEventDispatch = new DefaultServerIOEventDispatch(
                 listeningHandler, params);
-        
+
         Thread t = new Thread(new Runnable() {
-            
+
             public void run() {
                 try {
                     connectingIOReactor.execute(connectingEventDispatch);
@@ -170,10 +170,10 @@ public class NHttpReverseProxy {
                     System.err.println("I/O error: " + e.getMessage());
                 }
             }
-            
+
         });
         t.start();
-        
+
         try {
             listeningIOReactor.listen(new InetSocketAddress(8888));
             listeningIOReactor.execute(listeningEventDispatch);
@@ -187,16 +187,16 @@ public class NHttpReverseProxy {
     static class ListeningHandler implements NHttpServiceHandler {
 
         private final HttpHost targetHost;
-        private final ConnectingIOReactor connectingIOReactor;    
+        private final ConnectingIOReactor connectingIOReactor;
         private final HttpProcessor httpProcessor;
         private final HttpResponseFactory responseFactory;
         private final ConnectionReuseStrategy connStrategy;
         private final HttpParams params;
-        
+
         public ListeningHandler(
                 final HttpHost targetHost,
                 final ConnectingIOReactor connectingIOReactor,
-                final HttpProcessor httpProcessor, 
+                final HttpProcessor httpProcessor,
                 final HttpResponseFactory responseFactory,
                 final ConnectionReuseStrategy connStrategy,
                 final HttpParams params) {
@@ -213,26 +213,26 @@ public class NHttpReverseProxy {
             System.out.println(conn + " [client->proxy] conn open");
 
             ProxyTask proxyTask = new ProxyTask();
-            
+
             synchronized (proxyTask) {
 
                 // Initialize connection state
                 proxyTask.setTarget(this.targetHost);
                 proxyTask.setClientIOControl(conn);
                 proxyTask.setClientState(ConnState.CONNECTED);
-                
+
                 HttpContext context = conn.getContext();
                 context.setAttribute(ProxyTask.ATTRIB, proxyTask);
-                
+
                 InetSocketAddress address = new InetSocketAddress(
-                        this.targetHost.getHostName(), 
-                        this.targetHost.getPort()); 
-                
+                        this.targetHost.getHostName(),
+                        this.targetHost.getPort());
+
                 this.connectingIOReactor.connect(
-                        address, 
-                        null, 
-                        proxyTask, 
-                        null);            
+                        address,
+                        null,
+                        proxyTask,
+                        null);
             }
         }
 
@@ -252,25 +252,25 @@ public class NHttpReverseProxy {
                 try {
 
                     HttpRequest request = conn.getHttpRequest();
-                    
+
                     System.out.println(conn + " [client->proxy] >> " + request.getRequestLine());
-                    
+
                     ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
                     if (!ver.lessEquals(HttpVersion.HTTP_1_1)) {
-                        // Downgrade protocol version if greater than HTTP/1.1 
+                        // Downgrade protocol version if greater than HTTP/1.1
                         ver = HttpVersion.HTTP_1_1;
                     }
-                    
+
                     // Update connection state
                     proxyTask.setRequest(request);
                     proxyTask.setClientState(ConnState.REQUEST_RECEIVED);
-                    
+
                     // See if the client expects a 100-Continue
                     if (request instanceof HttpEntityEnclosingRequest) {
                         if (((HttpEntityEnclosingRequest) request).expectContinue()) {
                             HttpResponse ack = this.responseFactory.newHttpResponse(
-                                    ver, 
-                                    HttpStatus.SC_CONTINUE, 
+                                    ver,
+                                    HttpStatus.SC_CONTINUE,
                                     context);
                             conn.submitResponse(ack);
                         }
@@ -278,13 +278,13 @@ public class NHttpReverseProxy {
                         // No request content expected. Suspend client input
                         conn.suspendInput();
                     }
-                    
+
                     // If there is already a connection to the origin server
                     // make sure origin output is active
                     if (proxyTask.getOriginIOControl() != null) {
                         proxyTask.getOriginIOControl().requestOutput();
                     }
-                    
+
                 } catch (IOException ex) {
                     shutdownConnection(conn);
                 } catch (HttpException ex) {
@@ -305,7 +305,7 @@ public class NHttpReverseProxy {
                         && connState != ConnState.REQUEST_BODY_STREAM) {
                     throw new IllegalStateException("Illegal client connection state: " + connState);
                 }
-                
+
                 try {
 
                     ByteBuffer dst = proxyTask.getInBuffer();
@@ -317,7 +317,7 @@ public class NHttpReverseProxy {
                         // until the origin handler frees up some space in the buffer
                         conn.suspendInput();
                     }
-                    // If there is some content in the input buffer make sure origin 
+                    // If there is some content in the input buffer make sure origin
                     // output is active
                     if (dst.position() > 0) {
                         if (proxyTask.getOriginIOControl() != null) {
@@ -334,7 +334,7 @@ public class NHttpReverseProxy {
                     } else {
                         proxyTask.setClientState(ConnState.REQUEST_BODY_STREAM);
                     }
-                    
+
                 } catch (IOException ex) {
                     shutdownConnection(conn);
                 }
@@ -350,7 +350,7 @@ public class NHttpReverseProxy {
             synchronized (proxyTask) {
                 ConnState connState = proxyTask.getClientState();
                 if (connState == ConnState.IDLE) {
-                    // Response not available 
+                    // Response not available
                     return;
                 }
                 if (connState != ConnState.REQUEST_RECEIVED
@@ -375,27 +375,27 @@ public class NHttpReverseProxy {
                     response.removeHeaders("TE");
                     response.removeHeaders("Trailers");
                     response.removeHeaders("Upgrade");
-                    
+
                     response.setParams(
                             new DefaultedHttpParams(response.getParams(), this.params));
 
-                    // Close client connection if the connection to the target 
+                    // Close client connection if the connection to the target
                     // is no longer active / open
                     if (proxyTask.getOriginState().compareTo(ConnState.CLOSING) >= 0) {
-                        response.addHeader(HTTP.CONN_DIRECTIVE, "Close");    
+                        response.addHeader(HTTP.CONN_DIRECTIVE, "Close");
                     }
-                    
+
                     // Pre-process HTTP request
                     context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
                     context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
                     this.httpProcessor.process(response, context);
-                    
+
                     conn.submitResponse(response);
 
                     proxyTask.setClientState(ConnState.RESPONSE_SENT);
 
                     System.out.println(conn + " [client<-proxy] << " + response.getStatusLine());
-                    
+
                     if (!canResponseHaveBody(request, response)) {
                         conn.resetInput();
                         if (!this.connStrategy.keepAlive(response, context)) {
@@ -409,7 +409,7 @@ public class NHttpReverseProxy {
                             // Ready to deal with a new request
                         }
                     }
-                    
+
                 } catch (IOException ex) {
                     shutdownConnection(conn);
                 } catch (HttpException ex) {
@@ -417,21 +417,21 @@ public class NHttpReverseProxy {
                 }
             }
         }
-        
+
         private boolean canResponseHaveBody(
                 final HttpRequest request, final HttpResponse response) {
 
             if (request != null && "HEAD".equalsIgnoreCase(request.getRequestLine().getMethod())) {
                 return false;
             }
-            
-            int status = response.getStatusLine().getStatusCode(); 
-            return status >= HttpStatus.SC_OK 
-                && status != HttpStatus.SC_NO_CONTENT 
+
+            int status = response.getStatusLine().getStatusCode();
+            return status >= HttpStatus.SC_OK
+                && status != HttpStatus.SC_NO_CONTENT
                 && status != HttpStatus.SC_NOT_MODIFIED
-                && status != HttpStatus.SC_RESET_CONTENT; 
+                && status != HttpStatus.SC_RESET_CONTENT;
         }
-        
+
         public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder) {
             System.out.println(conn + " [client<-proxy] output ready");
 
@@ -449,7 +449,7 @@ public class NHttpReverseProxy {
                 if (response == null) {
                     throw new IllegalStateException("HTTP request is null");
                 }
-                
+
                 try {
 
                     ByteBuffer src = proxyTask.getOutBuffer();
@@ -464,7 +464,7 @@ public class NHttpReverseProxy {
                         if (proxyTask.getOriginState() == ConnState.RESPONSE_BODY_DONE) {
                             encoder.complete();
                         } else {
-                            // Input output is empty. Wait until the origin handler 
+                            // Input output is empty. Wait until the origin handler
                             // fills up the buffer
                             conn.suspendOutput();
                         }
@@ -489,10 +489,10 @@ public class NHttpReverseProxy {
                         // Make sure origin input is active
                         proxyTask.getOriginIOControl().requestInput();
                     }
-                    
+
                 } catch (IOException ex) {
                     shutdownConnection(conn);
-                } 
+                }
             }
         }
 
@@ -515,7 +515,7 @@ public class NHttpReverseProxy {
                 shutdownConnection(conn);
                 return;
             }
-            
+
             HttpContext context = conn.getContext();
 
             try {
@@ -528,11 +528,11 @@ public class NHttpReverseProxy {
                 context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
                 context.setAttribute(ExecutionContext.HTTP_REQUEST, null);
                 this.httpProcessor.process(response, context);
-                
+
                 conn.submitResponse(response);
 
                 conn.close();
-                
+
             } catch (IOException ex) {
                 shutdownConnection(conn);
             } catch (HttpException ex) {
@@ -544,12 +544,12 @@ public class NHttpReverseProxy {
             shutdownConnection(conn);
             System.out.println(conn + " [client->proxy] I/O error: " + ex.getMessage());
         }
-        
+
         public void timeout(final NHttpServerConnection conn) {
             System.out.println(conn + " [client->proxy] timeout");
             closeConnection(conn);
         }
-        
+
         private void shutdownConnection(final NHttpConnection conn) {
             try {
                 conn.shutdown();
@@ -565,15 +565,15 @@ public class NHttpReverseProxy {
         }
 
     }
-    
+
     static class ConnectingHandler implements NHttpClientHandler {
 
         private final HttpProcessor httpProcessor;
         private final ConnectionReuseStrategy connStrategy;
         private final HttpParams params;
-        
+
         public ConnectingHandler(
-                final HttpProcessor httpProcessor, 
+                final HttpProcessor httpProcessor,
                 final ConnectionReuseStrategy connStrategy,
                 final HttpParams params) {
             super();
@@ -581,10 +581,10 @@ public class NHttpReverseProxy {
             this.connStrategy = connStrategy;
             this.params = params;
         }
-        
+
         public void connected(final NHttpClientConnection conn, final Object attachment) {
             System.out.println(conn + " [proxy->origin] conn open");
-            
+
             // The shared state object is expected to be passed as an attachment
             ProxyTask proxyTask = (ProxyTask) attachment;
 
@@ -601,7 +601,7 @@ public class NHttpReverseProxy {
                 context.setAttribute(ProxyTask.ATTRIB, proxyTask);
                 // Update connection state
                 proxyTask.setOriginState(ConnState.CONNECTED);
-                
+
                 if (proxyTask.getRequest() != null) {
                     conn.requestOutput();
                 }
@@ -616,7 +616,7 @@ public class NHttpReverseProxy {
 
             synchronized (proxyTask) {
                 ConnState connState = proxyTask.getOriginState();
-                if (connState == ConnState.REQUEST_SENT 
+                if (connState == ConnState.REQUEST_SENT
                         || connState == ConnState.REQUEST_BODY_DONE) {
                     // Request sent but no response available yet
                     return;
@@ -631,7 +631,7 @@ public class NHttpReverseProxy {
                 if (request == null) {
                     throw new IllegalStateException("HTTP request is null");
                 }
-                
+
                 // Remove hop-by-hop headers
                 request.removeHeaders(HTTP.CONTENT_LEN);
                 request.removeHeaders(HTTP.TRANSFER_ENCODING);
@@ -644,14 +644,14 @@ public class NHttpReverseProxy {
                 request.removeHeaders("Upgrade");
                 // Remove host header
                 request.removeHeaders(HTTP.TARGET_HOST);
-                
+
                 HttpHost targetHost = proxyTask.getTarget();
-                
+
                 try {
-                    
+
                     request.setParams(
                             new DefaultedHttpParams(request.getParams(), this.params));
-                    
+
                     // Pre-process HTTP request
                     context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
                     context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, targetHost);
@@ -661,21 +661,21 @@ public class NHttpReverseProxy {
                     conn.submitRequest(request);
                     // Update connection state
                     proxyTask.setOriginState(ConnState.REQUEST_SENT);
-                    
+
                     System.out.println(conn + " [proxy->origin] >> " + request.getRequestLine().toString());
-                    
+
                 } catch (IOException ex) {
                     shutdownConnection(conn);
                 } catch (HttpException ex) {
                     shutdownConnection(conn);
                 }
-                
+
             }
         }
 
         public void outputReady(final NHttpClientConnection conn, final ContentEncoder encoder) {
             System.out.println(conn + " [proxy->origin] output ready");
-            
+
             HttpContext context = conn.getContext();
             ProxyTask proxyTask = (ProxyTask) context.getAttribute(ProxyTask.ATTRIB);
 
@@ -685,21 +685,21 @@ public class NHttpReverseProxy {
                         && connState != ConnState.REQUEST_BODY_STREAM) {
                     throw new IllegalStateException("Illegal target connection state: " + connState);
                 }
-                
+
                 try {
-                    
+
                     ByteBuffer src = proxyTask.getInBuffer();
                     src.flip();
                     int bytesWritten = encoder.write(src);
                     System.out.println(conn + " [proxy->origin] " + bytesWritten + " bytes written");
                     System.out.println(conn + " [proxy->origin] " + encoder);
                     src.compact();
-                    
+
                     if (src.position() == 0) {
                         if (proxyTask.getClientState() == ConnState.REQUEST_BODY_DONE) {
                             encoder.complete();
                         } else {
-                            // Input buffer is empty. Wait until the client fills up 
+                            // Input buffer is empty. Wait until the client fills up
                             // the buffer
                             conn.suspendOutput();
                         }
@@ -713,7 +713,7 @@ public class NHttpReverseProxy {
                         // Make sure client input is active
                         proxyTask.getClientIOControl().requestInput();
                     }
-                    
+
                 } catch (IOException ex) {
                     shutdownConnection(conn);
                 }
@@ -722,7 +722,7 @@ public class NHttpReverseProxy {
 
         public void responseReceived(final NHttpClientConnection conn) {
             System.out.println(conn + " [proxy<-origin] response received");
-            
+
             HttpContext context = conn.getContext();
             ProxyTask proxyTask = (ProxyTask) context.getAttribute(ProxyTask.ATTRIB);
 
@@ -737,18 +737,18 @@ public class NHttpReverseProxy {
                 HttpRequest request = proxyTask.getRequest();
 
                 System.out.println(conn + " [proxy<-origin] << " + response.getStatusLine());
-                
+
                 int statusCode = response.getStatusLine().getStatusCode();
                 if (statusCode < HttpStatus.SC_OK) {
                     // Ignore 1xx response
                     return;
                 }
                 try {
-                
+
                     // Update connection state
                     proxyTask.setResponse(response);
                     proxyTask.setOriginState(ConnState.RESPONSE_RECEIVED);
-                    
+
                     if (!canResponseHaveBody(request, response)) {
                         conn.resetInput();
                         if (!this.connStrategy.keepAlive(response, context)) {
@@ -773,14 +773,14 @@ public class NHttpReverseProxy {
             if (request != null && "HEAD".equalsIgnoreCase(request.getRequestLine().getMethod())) {
                 return false;
             }
-            
-            int status = response.getStatusLine().getStatusCode(); 
-            return status >= HttpStatus.SC_OK 
-                && status != HttpStatus.SC_NO_CONTENT 
+
+            int status = response.getStatusLine().getStatusCode();
+            return status >= HttpStatus.SC_OK
+                && status != HttpStatus.SC_NO_CONTENT
                 && status != HttpStatus.SC_NOT_MODIFIED
-                && status != HttpStatus.SC_RESET_CONTENT; 
+                && status != HttpStatus.SC_RESET_CONTENT;
         }
-        
+
         public void inputReady(final NHttpClientConnection conn, final ContentDecoder decoder) {
             System.out.println(conn + " [proxy<-origin] input ready");
 
@@ -796,22 +796,22 @@ public class NHttpReverseProxy {
 
                 HttpResponse response = proxyTask.getResponse();
                 try {
-                    
+
                     ByteBuffer dst = proxyTask.getOutBuffer();
                     int bytesRead = decoder.read(dst);
                     System.out.println(conn + " [proxy<-origin] " + bytesRead + " bytes read");
                     System.out.println(conn + " [proxy<-origin] " + decoder);
                     if (!dst.hasRemaining()) {
-                        // Output buffer is full. Suspend origin input until 
+                        // Output buffer is full. Suspend origin input until
                         // the client handler frees up some space in the buffer
                         conn.suspendInput();
                     }
-                    // If there is some content in the buffer make sure client output 
+                    // If there is some content in the buffer make sure client output
                     // is active
                     if (dst.position() > 0) {
                         proxyTask.getClientIOControl().requestOutput();
                     }
-                    
+
                     if (decoder.isCompleted()) {
                         System.out.println(conn + " [proxy<-origin] response body received");
                         proxyTask.setOriginState(ConnState.RESPONSE_BODY_DONE);
@@ -824,7 +824,7 @@ public class NHttpReverseProxy {
                     } else {
                         proxyTask.setOriginState(ConnState.RESPONSE_BODY_STREAM);
                     }
-                    
+
                 } catch (IOException ex) {
                     shutdownConnection(conn);
                 }
@@ -852,19 +852,19 @@ public class NHttpReverseProxy {
             shutdownConnection(conn);
             System.out.println(conn + " [proxy->origin] I/O error: " + ex.getMessage());
         }
-        
+
         public void timeout(final NHttpClientConnection conn) {
             System.out.println(conn + " [proxy->origin] timeout");
             closeConnection(conn);
         }
-     
+
         private void shutdownConnection(final HttpConnection conn) {
             try {
                 conn.shutdown();
             } catch (IOException ignore) {
             }
         }
-        
+
         private void closeConnection(final HttpConnection conn) {
             try {
                 conn.shutdown();
@@ -872,8 +872,8 @@ public class NHttpReverseProxy {
             }
         }
 
-    }    
-    
+    }
+
     enum ConnState {
         IDLE,
         CONNECTED,
@@ -888,25 +888,25 @@ public class NHttpReverseProxy {
         CLOSING,
         CLOSED
     }
-    
+
     static class ProxyTask {
-        
+
         public static final String ATTRIB = "nhttp.proxy-task";
-        
+
         private final ByteBuffer inBuffer;
         private final ByteBuffer outBuffer;
 
         private HttpHost target;
-        
+
         private IOControl originIOControl;
         private IOControl clientIOControl;
-        
+
         private ConnState originState;
         private ConnState clientState;
-        
+
         private HttpRequest request;
         private HttpResponse response;
-        
+
         public ProxyTask() {
             super();
             this.originState = ConnState.IDLE;
@@ -922,7 +922,7 @@ public class NHttpReverseProxy {
         public ByteBuffer getOutBuffer() {
             return this.outBuffer;
         }
-        
+
         public HttpHost getTarget() {
             return this.target;
         }
@@ -962,7 +962,7 @@ public class NHttpReverseProxy {
         public void setOriginIOControl(final IOControl originIOControl) {
             this.originIOControl = originIOControl;
         }
-        
+
         public ConnState getOriginState() {
             return this.originState;
         }
@@ -970,7 +970,7 @@ public class NHttpReverseProxy {
         public void setOriginState(final ConnState state) {
             this.originState = state;
         }
-        
+
         public ConnState getClientState() {
             return this.clientState;
         }
@@ -987,7 +987,7 @@ public class NHttpReverseProxy {
             this.request = null;
             this.response = null;
         }
-        
+
         public void shutdown() {
             if (this.clientIOControl != null) {
                 try {
@@ -1004,5 +1004,5 @@ public class NHttpReverseProxy {
         }
 
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java Fri Aug 12 10:35:32 2011
@@ -28,6 +28,7 @@ package org.apache.http.examples.nio;
 
 import java.io.IOException;
 import java.io.InterruptedIOException;
+import java.nio.channels.SelectionKey;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -44,11 +45,11 @@ import org.apache.http.impl.nio.pool.Bas
 import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
 import org.apache.http.impl.nio.ssl.SSLClientIOEventDispatch;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.protocol.BufferingHttpClientHandler;
 import org.apache.http.nio.protocol.HttpRequestExecutionHandler;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.CoreProtocolPNames;
 import org.apache.http.params.HttpParams;
@@ -80,9 +81,9 @@ public class NHttpSSLClient {
             .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
             .setParameter(CoreProtocolPNames.USER_AGENT, "Test/1.1");
 
-        final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(2, params);
+        final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
 
-        BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor, params);
+        BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor);
         // Limit total number of connections to just two
         pool.setDefaultMaxPerRoute(2);
         pool.setMaxTotal(2);
@@ -175,9 +176,9 @@ public class NHttpSSLClient {
 
         public void completed(final BasicNIOPoolEntry entry) {
             this.poolEntry = entry;
-            NHttpConnection conn = entry.getConnection();
-            conn.getContext().setAttribute("executor", this);
-            conn.requestOutput();
+            IOSession session = entry.getConnection();
+            session.setAttribute("executor", this);
+            session.setEvent(SelectionKey.OP_WRITE);
             System.out.println(this.poolEntry.getRoute() + ": obtained connection from the pool");
         }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java Fri Aug 12 10:35:32 2011
@@ -138,7 +138,7 @@ public class NHttpSSLServer {
                 sslcontext,
                 params);
 
-        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
+        ListeningIOReactor ioReactor = new DefaultListeningIOReactor();
         try {
             ioReactor.listen(new InetSocketAddress(8080));
             ioReactor.execute(ioEventDispatch);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java Fri Aug 12 10:35:32 2011
@@ -115,7 +115,7 @@ public class NHttpServer {
         handler.setEventListener(new EventLogger());
 
         IOEventDispatch ioEventDispatch = new DefaultServerIOEventDispatch(handler, params);
-        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
+        ListeningIOReactor ioReactor = new DefaultListeningIOReactor();
         try {
             ioReactor.listen(new InetSocketAddress(8080));
             ioReactor.execute(ioEventDispatch);

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=1157038&r1=1157037&r2=1157038&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 Fri Aug 12 10:35:32 2011
@@ -26,42 +26,23 @@
  */
 package org.apache.http.impl.nio.pool;
 
-import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.http.HttpConnection;
 import org.apache.http.HttpHost;
-import org.apache.http.HttpResponseFactory;
 import org.apache.http.annotation.ThreadSafe;
-import org.apache.http.impl.DefaultHttpResponseFactory;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.nio.NHttpClientConnection;
 import org.apache.http.nio.pool.AbstractNIOConnPool;
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOSession;
-import org.apache.http.nio.util.ByteBufferAllocator;
-import org.apache.http.nio.util.HeapByteBufferAllocator;
-import org.apache.http.params.HttpParams;
 
 @ThreadSafe
-public class BasicNIOConnPool extends AbstractNIOConnPool<HttpHost, NHttpClientConnection, BasicNIOPoolEntry> {
+public class BasicNIOConnPool extends AbstractNIOConnPool<HttpHost, IOSession, BasicNIOPoolEntry> {
 
     private static AtomicLong COUNTER = new AtomicLong();
 
-    private final HttpResponseFactory responseFactory;
-    private final ByteBufferAllocator allocator;
-    private final HttpParams params;
-
-    public BasicNIOConnPool(final ConnectingIOReactor ioreactor, final HttpParams params) {
+    public BasicNIOConnPool(final ConnectingIOReactor ioreactor) {
         super(ioreactor, 2, 20);
-        if (params == null) {
-            throw new IllegalArgumentException("HTTP params may not be null");
-        }
-        this.responseFactory = new DefaultHttpResponseFactory();
-        this.allocator = new HeapByteBufferAllocator();
-        this.params = params;
     }
 
     @Override
@@ -75,23 +56,19 @@ public class BasicNIOConnPool extends Ab
     }
 
     @Override
-    protected NHttpClientConnection createConnection(final HttpHost route, final IOSession session) {
-        return new DefaultNHttpClientConnection(session,
-                this.responseFactory, this.allocator, this.params);
+    protected IOSession createConnection(final HttpHost route, final IOSession session) {
+        return session;
     }
 
     @Override
-    protected BasicNIOPoolEntry createEntry(final HttpHost host, final NHttpClientConnection conn) {
+    protected BasicNIOPoolEntry createEntry(final HttpHost host, final IOSession conn) {
         return new BasicNIOPoolEntry(Long.toString(COUNTER.getAndIncrement()), host, conn);
     }
 
     @Override
     protected void closeEntry(final BasicNIOPoolEntry entry) {
-        HttpConnection conn = entry.getConnection();
-        try {
-            conn.close();
-        } catch (IOException ignore) {
-        }
+        IOSession iosession = entry.getConnection();
+        iosession.shutdown();
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOPoolEntry.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOPoolEntry.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOPoolEntry.java Fri Aug 12 10:35:32 2011
@@ -28,13 +28,13 @@ package org.apache.http.impl.nio.pool;
 
 import org.apache.http.HttpHost;
 import org.apache.http.annotation.ThreadSafe;
-import org.apache.http.nio.NHttpClientConnection;
+import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.pool.PoolEntry;
 
 @ThreadSafe
-public class BasicNIOPoolEntry extends PoolEntry<HttpHost, NHttpClientConnection> {
+public class BasicNIOPoolEntry extends PoolEntry<HttpHost, IOSession> {
 
-    public BasicNIOPoolEntry(final String id, final HttpHost route, final NHttpClientConnection conn) {
+    public BasicNIOPoolEntry(final String id, final HttpHost route, final IOSession conn) {
         super(id, route, conn);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java Fri Aug 12 10:35:32 2011
@@ -50,6 +50,7 @@ import org.apache.http.nio.reactor.IORea
 import org.apache.http.nio.reactor.IOReactorException;
 import org.apache.http.nio.reactor.IOReactorExceptionHandler;
 import org.apache.http.nio.reactor.IOReactorStatus;
+import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
 
@@ -104,12 +105,15 @@ import org.apache.http.params.HttpParams
  *
  * @since 4.0
  */
+@SuppressWarnings("deprecation")
 @ThreadSafe // public methods only
 public abstract class AbstractMultiworkerIOReactor implements IOReactor {
 
     protected volatile IOReactorStatus status;
 
+    @Deprecated
     protected final HttpParams params;
+    protected final IOReactorConfig config;
     protected final Selector selector;
     protected final long selectTimeout;
     protected final boolean interestOpsQueueing;
@@ -127,46 +131,97 @@ public abstract class AbstractMultiworke
     private int currentWorker = 0;
 
     /**
-     * Creates an instance of AbstractMultiworkerIOReactor.
+     * Creates an instance of AbstractMultiworkerIOReactor with the given configuration.
      *
-     * @param workerCount number of worker I/O reactors.
+     * @param config I/O reactor configuration.
      * @param threadFactory the factory to create threads.
      *   Can be <code>null</code>.
-     * @param params HTTP parameters.
      * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @since 4.2
      */
     public AbstractMultiworkerIOReactor(
-            int workerCount,
-            final ThreadFactory threadFactory,
-            final HttpParams params) throws IOReactorException {
+            final IOReactorConfig config,
+            final ThreadFactory threadFactory) throws IOReactorException {
         super();
-        if (workerCount <= 0) {
-            throw new IllegalArgumentException("Worker count may not be negative or zero");
-        }
-        if (params == null) {
-            throw new IllegalArgumentException("HTTP parameters may not be null");
+        if (config != null) {
+            try {
+                this.config = config.clone();
+            } catch (CloneNotSupportedException ex) {
+                throw new IOReactorException("Unable to clone configuration");
+            }
+        } else {
+            this.config = new IOReactorConfig();
         }
+        this.params = new BasicHttpParams();
         try {
             this.selector = Selector.open();
         } catch (IOException ex) {
             throw new IOReactorException("Failure opening selector", ex);
         }
-        this.params = params;
-        this.selectTimeout = NIOReactorParams.getSelectInterval(params);
-        this.interestOpsQueueing = NIOReactorParams.getInterestOpsQueueing(params);
+        this.selectTimeout = this.config.getSelectInterval();
+        this.interestOpsQueueing = this.config.isInterestOpQueued();
         this.statusLock = new Object();
-        this.workerCount = workerCount;
         if (threadFactory != null) {
             this.threadFactory = threadFactory;
         } else {
             this.threadFactory = new DefaultThreadFactory();
         }
+        this.workerCount = this.config.getIoThreadCount();
         this.dispatchers = new BaseIOReactor[workerCount];
         this.workers = new Worker[workerCount];
         this.threads = new Thread[workerCount];
         this.status = IOReactorStatus.INACTIVE;
     }
 
+    /**
+     * Creates an instance of AbstractMultiworkerIOReactor with default configuration.
+     *
+     * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @since 4.2
+     */
+    public AbstractMultiworkerIOReactor() throws IOReactorException {
+        this(null, null);
+    }
+
+    static IOReactorConfig convert(int workerCount, final HttpParams params) {
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be null");
+        }
+        IOReactorConfig config = new IOReactorConfig();
+        config.setSelectInterval(NIOReactorParams.getSelectInterval(params));
+        config.setShutdownGracePeriod(NIOReactorParams.getGracePeriod(params));
+        config.setInterestOpQueued(NIOReactorParams.getInterestOpsQueueing(params));
+        config.setIoThreadCount(workerCount);
+        config.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params));
+        config.setSoTimeout(HttpConnectionParams.getSoTimeout(params));
+        config.setSoLinger(HttpConnectionParams.getLinger(params));
+        config.setConnectTimeout(HttpConnectionParams.getConnectionTimeout(params));
+        config.setSoReuseAddress(HttpConnectionParams.getSoReuseaddr(params));
+
+        return config;
+    }
+
+    /**
+     * Creates an instance of AbstractMultiworkerIOReactor.
+     *
+     * @param workerCount number of worker I/O reactors.
+     * @param threadFactory the factory to create threads.
+     *   Can be <code>null</code>.
+     * @param params HTTP parameters.
+     * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @deprecated use {@link AbstractMultiworkerIOReactor#AbstractMultiworkerIOReactor(IOReactorConfig, ThreadFactory)}
+     */
+    @Deprecated
+    public AbstractMultiworkerIOReactor(
+            int workerCount,
+            final ThreadFactory threadFactory,
+            final HttpParams params) throws IOReactorException {
+        this(convert(workerCount, params), threadFactory);
+    }
+
     public IOReactorStatus getStatus() {
         return this.status;
     }
@@ -400,7 +455,7 @@ public abstract class AbstractMultiworke
             dispatcher.gracefulShutdown();
         }
 
-        long gracePeriod = NIOReactorParams.getGracePeriod(this.params);
+        long gracePeriod = this.config.getShutdownGracePeriod();
 
         try {
             // Force shut down I/O dispatchers if they fail to terminate
@@ -463,9 +518,9 @@ public abstract class AbstractMultiworke
      * @throws IOException in case of an I/O error.
      */
     protected void prepareSocket(final Socket socket) throws IOException {
-        socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(this.params));
-        socket.setSoTimeout(HttpConnectionParams.getSoTimeout(this.params));
-        int linger = HttpConnectionParams.getLinger(this.params);
+        socket.setTcpNoDelay(this.config.isTcpNoDelay());
+        socket.setSoTimeout(this.config.getSoTimeout());
+        int linger = this.config.getSoLinger();
         if (linger >= 0) {
             socket.setSoLinger(linger > 0, linger);
         }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java Fri Aug 12 10:35:32 2011
@@ -47,26 +47,12 @@ import org.apache.http.nio.reactor.IORea
 import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.SessionRequest;
 import org.apache.http.nio.reactor.SessionRequestCallback;
-import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
 
 /**
  * Default implementation of {@link ConnectingIOReactor}. This class extends
  * {@link AbstractMultiworkerIOReactor} with capability to connect to remote
  * hosts.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#TCP_NODELAY}</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#SO_LINGER}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SO_REUSEADDR}</li>
- *  <li>{@link org.apache.http.nio.params.NIOReactorPNames#SELECT_INTERVAL}</li>
- *  <li>{@link org.apache.http.nio.params.NIOReactorPNames#GRACE_PERIOD}</li>
- *  <li>{@link org.apache.http.nio.params.NIOReactorPNames#INTEREST_OPS_QUEUEING}</li>
- * </ul>
  *
  * @since 4.0
  */
@@ -78,19 +64,65 @@ public class DefaultConnectingIOReactor 
 
     private long lastTimeoutCheck;
 
+    /**
+     * Creates an instance of DefaultConnectingIOReactor with the given configuration.
+     *
+     * @param config I/O reactor configuration.
+     * @param threadFactory the factory to create threads.
+     *   Can be <code>null</code>.
+     * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @since 4.2
+     */
+    public DefaultConnectingIOReactor(
+            final IOReactorConfig config,
+            final ThreadFactory threadFactory) throws IOReactorException {
+        super(config, threadFactory);
+        this.requestQueue = new ConcurrentLinkedQueue<SessionRequestImpl>();
+        this.lastTimeoutCheck = System.currentTimeMillis();
+    }
+
+    /**
+     * Creates an instance of DefaultConnectingIOReactor with the given configuration.
+     *
+     * @param config I/O reactor configuration.
+     *   Can be <code>null</code>.
+     * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @since 4.2
+     */
+    public DefaultConnectingIOReactor(final IOReactorConfig config) throws IOReactorException {
+        this(config, null);
+    }
+
+    /**
+     * Creates an instance of DefaultConnectingIOReactor with default configuration.
+     *
+     * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @since 4.2
+     */
+    public DefaultConnectingIOReactor() throws IOReactorException {
+        this(null, null);
+    }
+
+    /**
+     * @deprecated use {@link DefaultConnectingIOReactor#DefaultConnectingIOReactor(IOReactorConfig, ThreadFactory)}
+     */
     public DefaultConnectingIOReactor(
             int workerCount,
             final ThreadFactory threadFactory,
             final HttpParams params) throws IOReactorException {
-        super(workerCount, threadFactory, params);
-        this.requestQueue = new ConcurrentLinkedQueue<SessionRequestImpl>();
-        this.lastTimeoutCheck = System.currentTimeMillis();
+        this(convert(workerCount, params), threadFactory);
     }
 
+    /**
+     * @deprecated use {@link DefaultConnectingIOReactor#DefaultConnectingIOReactor(IOReactorConfig)}
+     */
     public DefaultConnectingIOReactor(
             int workerCount,
             final HttpParams params) throws IOReactorException {
-        this(workerCount, null, params);
+        this(convert(workerCount, params), null);
     }
 
     @Override
@@ -196,7 +228,7 @@ public class DefaultConnectingIOReactor 
         }
         SessionRequestImpl sessionRequest = new SessionRequestImpl(
                 remoteAddress, localAddress, attachment, callback);
-        sessionRequest.setConnectTimeout(HttpConnectionParams.getConnectionTimeout(this.params));
+        sessionRequest.setConnectTimeout(this.config.getConnectTimeout());
 
         this.requestQueue.add(sessionRequest);
         this.selector.wakeup();
@@ -235,7 +267,7 @@ public class DefaultConnectingIOReactor 
 
                 if (request.getLocalAddress() != null) {
                     Socket sock = socketChannel.socket();
-                    sock.setReuseAddress(HttpConnectionParams.getSoReuseaddr(this.params));
+                    sock.setReuseAddress(this.config.isSoReuseAddress());
                     sock.bind(request.getLocalAddress());
                 }
                 boolean connected = socketChannel.connect(request.getRemoteAddress());

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java Fri Aug 12 10:35:32 2011
@@ -52,17 +52,6 @@ import org.apache.http.params.HttpParams
  * Default implementation of {@link ListeningIOReactor}. This class extends
  * {@link AbstractMultiworkerIOReactor} with capability to listen for incoming
  * connections.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#TCP_NODELAY}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SO_TIMEOUT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SO_LINGER}</li>
- *  <li>{@link org.apache.http.nio.params.NIOReactorPNames#SELECT_INTERVAL}</li>
- *  <li>{@link org.apache.http.nio.params.NIOReactorPNames#GRACE_PERIOD}</li>
- *  <li>{@link org.apache.http.nio.params.NIOReactorPNames#INTEREST_OPS_QUEUEING}</li>
- * </ul>
  *
  * @since 4.0
  */
@@ -76,22 +65,67 @@ public class DefaultListeningIOReactor e
 
     private volatile boolean paused;
 
+    /**
+     * Creates an instance of DefaultListeningIOReactor with the given configuration.
+     *
+     * @param config I/O reactor configuration.
+     * @param threadFactory the factory to create threads.
+     *   Can be <code>null</code>.
+     * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @since 4.2
+     */
     public DefaultListeningIOReactor(
-            int workerCount,
-            final ThreadFactory threadFactory,
-            final HttpParams params) throws IOReactorException {
-        super(workerCount, threadFactory, params);
+            final IOReactorConfig config,
+            final ThreadFactory threadFactory) throws IOReactorException {
+        super(config, threadFactory);
         this.requestQueue = new ConcurrentLinkedQueue<ListenerEndpointImpl>();
         this.endpoints = Collections.synchronizedSet(new HashSet<ListenerEndpointImpl>());
         this.pausedEndpoints = new HashSet<SocketAddress>();
     }
 
+    /**
+     * Creates an instance of DefaultListeningIOReactor with the given configuration.
+     *
+     * @param config I/O reactor configuration.
+     *   Can be <code>null</code>.
+     * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @since 4.2
+     */
+    public DefaultListeningIOReactor(final IOReactorConfig config) throws IOReactorException {
+        this(config, null);
+    }
+
+    /**
+     * Creates an instance of DefaultListeningIOReactor with default configuration.
+     *
+     * @throws IOReactorException in case if a non-recoverable I/O error.
+     *
+     * @since 4.2
+     */
+    public DefaultListeningIOReactor() throws IOReactorException {
+        this(null, null);
+    }
+
+    /**
+     * @deprecated use {@link DefaultListeningIOReactor#DefaultListeningIOReactor(IOReactorConfig, ThreadFactory)}
+     */
     public DefaultListeningIOReactor(
             int workerCount,
+            final ThreadFactory threadFactory,
             final HttpParams params) throws IOReactorException {
-        this(workerCount, null, params);
+        this(convert(workerCount, params), threadFactory);
     }
 
+    /**
+     * @deprecated use {@link DefaultListeningIOReactor#DefaultListeningIOReactor(IOReactorConfig)}
+     */
+    public DefaultListeningIOReactor(
+            int workerCount,
+            final HttpParams params) throws IOReactorException {
+        this(convert(workerCount, params), null);
+    }
 
     @Override
     protected void cancelRequests() throws IOReactorException {

Added: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java?rev=1157038&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java (added)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java Fri Aug 12 10:35:32 2011
@@ -0,0 +1,264 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl.nio.reactor;
+
+import java.net.SocketOptions;
+import java.nio.channels.SelectionKey;
+
+import org.apache.http.annotation.NotThreadSafe;
+
+/**
+ * I/O reactor configuration parameters.
+ *
+ * @since 4.2
+ */
+@NotThreadSafe
+public final class IOReactorConfig implements Cloneable {
+
+    private long selectInterval;
+    private long shutdownGracePeriod;
+    private boolean interestOpQueued;
+    private int ioThreadCount;
+    private int soTimeout;
+    private boolean soReuseAddress;
+    private int soLinger;
+    private boolean tcpNoDelay;
+    private int connectTimeout;
+
+    public IOReactorConfig() {
+        super();
+        this.selectInterval = 1000;
+        this.shutdownGracePeriod = 500;
+        this.interestOpQueued = false;
+        this.ioThreadCount = 2;
+        this.soTimeout = 0;
+        this.soReuseAddress = false;
+        this.soLinger = -1;
+        this.tcpNoDelay = false;
+        this.connectTimeout = 0;
+    }
+
+    /**
+     * Determines time interval in milliseconds at which the I/O reactor wakes up to check for
+     * timed out sessions and session requests.
+     * <p/>
+     * Default: <code>1000</code> milliseconds.
+     */
+    public long getSelectInterval() {
+        return this.selectInterval;
+    }
+
+    /**
+     * Defines time interval in milliseconds at which the I/O reactor wakes up to check for
+     * timed out sessions and session requests. May not be negative or zero.
+     */
+    public void setSelectInterval(long selectInterval) {
+        if (selectInterval <= 0) {
+            throw new IllegalArgumentException("Select internal may not be negative or zero");
+        }
+        this.selectInterval = selectInterval;
+    }
+
+    /**
+     * Determines grace period in milliseconds the I/O reactors are expected to block waiting
+     * for individual worker threads to terminate cleanly.
+     * <p/>
+     * Default: <code>500</code> milliseconds.
+     */
+    public long getShutdownGracePeriod() {
+        return this.shutdownGracePeriod;
+    }
+
+    /**
+     * Defines grace period in milliseconds the I/O reactors are expected to block waiting
+     * for individual worker threads to terminate cleanly. May not be negative or zero.
+     */
+    public void setShutdownGracePeriod(long gracePeriod) {
+        if (gracePeriod <= 0) {
+            throw new IllegalArgumentException("Shutdown grace period may not be negative or zero");
+        }
+        this.shutdownGracePeriod = gracePeriod;
+    }
+
+    /**
+     * Determines whether or not I/O interest operations are to be queued and executed
+     * asynchronously by the I/O reactor thread or to be applied to the underlying
+     * {@link SelectionKey} immediately.
+     * <p/>
+     * Default: <code>false</code>
+     *
+     * @see {@link SelectionKey}
+     * @see {@link SelectionKey#interestOps()}
+     * @see {@link SelectionKey#interestOps(int)}
+     */
+    public boolean isInterestOpQueued() {
+        return this.interestOpQueued;
+    }
+
+    /**
+     * Defines whether or not I/O interest operations are to be queued and executed
+     * asynchronously by the I/O reactor thread or to be applied to the underlying
+     * {@link SelectionKey} immediately.
+     *
+     * @see {@link SelectionKey}
+     * @see {@link SelectionKey#interestOps()}
+     * @see {@link SelectionKey#interestOps(int)}
+     */
+    public void setInterestOpQueued(boolean interestOpQueued) {
+        this.interestOpQueued = interestOpQueued;
+    }
+
+    /**
+     * Determines the number of I/O dispatch threads to be used by the I/O reactor.
+     * <p/>
+     * Default: <code>2</code>
+     */
+    public int getIoThreadCount() {
+        return this.ioThreadCount;
+    }
+
+    /**
+     * Defines the number of I/O dispatch threads to be used by the I/O reactor.
+     * May not be negative or zero.
+     */
+    public void setIoThreadCount(int ioThreadCount) {
+        if (ioThreadCount <= 0) {
+            throw new IllegalArgumentException("I/O thread count may not be negative or zero");
+        }
+        this.ioThreadCount = ioThreadCount;
+    }
+
+    /**
+     * Determines the default socket timeout value for non-blocking I/O operations.
+     * <p/>
+     * Default: <code>0</code> (no timeout)
+     */
+    public int getSoTimeout() {
+        return soTimeout;
+    }
+
+    /**
+     * Defines the default socket timeout value for non-blocking I/O operations.
+     * <p/>
+     * Default: <code>0</code> (no timeout)
+     */
+    public void setSoTimeout(int soTimeout) {
+        this.soTimeout = soTimeout;
+    }
+
+    /**
+     * Determines the default value of the {@link SocketOptions#SO_REUSEADDR} parameter
+     * for newly created sockets.
+     * <p/>
+     * Default: <code>false</code>
+     */
+    public boolean isSoReuseAddress() {
+        return soReuseAddress;
+    }
+
+    /**
+     * Defines the default value of the {@link SocketOptions#SO_REUSEADDR} parameter
+     * for newly created sockets.
+     */
+    public void setSoReuseAddress(boolean soReuseAddress) {
+        this.soReuseAddress = soReuseAddress;
+    }
+
+    /**
+     * Determines the default value of the {@link SocketOptions#SO_LINGER} parameter
+     * for newly created sockets.
+     * <p/>
+     * Default: <code>-1</code>
+     */
+    public int getSoLinger() {
+        return soLinger;
+    }
+
+    /**
+     * Defines the default value of the {@link SocketOptions#SO_LINGER} parameter
+     * for newly created sockets.
+     */
+    public void setSoLinger(int soLinger) {
+        this.soLinger = soLinger;
+    }
+
+    /**
+     * Determines the default value of the {@link SocketOptions#TCP_NODELAY} parameter
+     * for newly created sockets.
+     * <p/>
+     * Default: <code>false</code>
+     */
+    public boolean isTcpNoDelay() {
+        return tcpNoDelay;
+    }
+
+    /**
+     * Defines the default value of the {@link SocketOptions#TCP_NODELAY} parameter
+     * for newly created sockets.
+     */
+    public void setTcpNoDelay(boolean tcpNoDelay) {
+        this.tcpNoDelay = tcpNoDelay;
+    }
+
+    /**
+     * Determines the default connect timeout value for non-blocking connection requests.
+     * <p/>
+     * Default: <code>0</code> (no timeout)
+     */
+    public int getConnectTimeout() {
+        return connectTimeout;
+    }
+
+    /**
+     * Defines the default connect timeout value for non-blocking connection requests.
+     */
+    public void setConnectTimeout(int connectTimeout) {
+        this.connectTimeout = connectTimeout;
+    }
+
+    @Override
+    protected IOReactorConfig clone() throws CloneNotSupportedException {
+        return (IOReactorConfig) super.clone();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("[selectInterval=").append(this.selectInterval)
+                .append(", shutdownGracePeriod=").append(this.shutdownGracePeriod)
+                .append(", interestOpQueued=").append(this.interestOpQueued)
+                .append(", ioThreadCount=").append(this.ioThreadCount)
+                .append(", soTimeout=").append(this.soTimeout)
+                .append(", soReuseAddress=").append(this.soReuseAddress)
+                .append(", soLinger=").append(this.soLinger)
+                .append(", tcpNoDelay=").append(this.tcpNoDelay)
+                .append(", connectTimeout=").append(this.connectTimeout).append("]");
+        return builder.toString();
+    }
+
+}

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOReactorConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java Fri Aug 12 10:35:32 2011
@@ -27,11 +27,16 @@
 
 package org.apache.http.nio.params;
 
+import org.apache.http.impl.nio.reactor.IOReactorConfig;
+
 /**
  * Parameter names for I/O reactors.
  *
  * @since 4.0
+ *
+ * @deprecated use {@link IOReactorConfig}
  */
+@Deprecated
 public interface NIOReactorPNames {
 
     /**

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParamBean.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParamBean.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParamBean.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParamBean.java Fri Aug 12 10:35:32 2011
@@ -27,12 +27,16 @@
 
 package org.apache.http.nio.params;
 
+import org.apache.http.impl.nio.reactor.IOReactorConfig;
 import org.apache.http.params.HttpAbstractParamBean;
 import org.apache.http.params.HttpParams;
 
 /**
  * @since 4.0
+ *
+ * @deprecated use {@link IOReactorConfig}
  */
+@Deprecated
 public class NIOReactorParamBean extends HttpAbstractParamBean {
 
     public NIOReactorParamBean (final HttpParams params) {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java Fri Aug 12 10:35:32 2011
@@ -27,6 +27,7 @@
 
 package org.apache.http.nio.params;
 
+import org.apache.http.impl.nio.reactor.IOReactorConfig;
 import org.apache.http.params.HttpParams;
 
 /**
@@ -35,7 +36,10 @@ import org.apache.http.params.HttpParams
  * @since 4.0
  *
  * @see NIOReactorPNames
+ *
+ * @deprecated use {@link IOReactorConfig}
  */
+@Deprecated
 public final class NIOReactorParams implements NIOReactorPNames {
 
     private NIOReactorParams() {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java Fri Aug 12 10:35:32 2011
@@ -88,12 +88,15 @@ import org.apache.http.protocol.HttpProc
  * The following parameters can be used to customize the behavior of this
  * class:
  * <ul>
- *  <li>{@link org.apache.http.params.CoreProtocolPNames#WAIT_FOR_CONTINUE}</li>
  *  <li>{@link org.apache.http.nio.params.NIOReactorPNames#CONTENT_BUFFER_SIZE}</li>
+ *  <li>{@link org.apache.http.params.CoreProtocolPNames#WAIT_FOR_CONTINUE}</li>
  * </ul>
  *
  * @since 4.0
+ *
+ * @deprecated Use {@link AsyncNHttpClientHandler}
  */
+@Deprecated
 @ThreadSafe // provided injected dependencies are immutable or thread safe
 public class ThrottlingHttpClientHandler extends NHttpHandlerBase
                                          implements NHttpClientHandler {
@@ -101,6 +104,8 @@ public class ThrottlingHttpClientHandler
     protected HttpRequestExecutionHandler execHandler;
     protected final Executor executor;
 
+    private final int bufsize;
+
     public ThrottlingHttpClientHandler(
             final HttpProcessor httpProcessor,
             final HttpRequestExecutionHandler execHandler,
@@ -117,6 +122,7 @@ public class ThrottlingHttpClientHandler
         }
         this.execHandler = execHandler;
         this.executor = executor;
+        this.bufsize = this.params.getIntParameter(NIOReactorPNames.CONTENT_BUFFER_SIZE, 20480);
     }
 
     public ThrottlingHttpClientHandler(
@@ -134,9 +140,7 @@ public class ThrottlingHttpClientHandler
 
         initialize(conn, attachment);
 
-        int bufsize = this.params.getIntParameter(
-                NIOReactorPNames.CONTENT_BUFFER_SIZE, 20480);
-        ClientConnState connState = new ClientConnState(bufsize, conn, this.allocator);
+        ClientConnState connState = new ClientConnState(this.bufsize, conn, this.allocator);
         context.setAttribute(CONN_STATE, connState);
 
         if (this.eventListener != null) {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java Fri Aug 12 10:35:32 2011
@@ -95,12 +95,18 @@ import org.apache.http.util.EntityUtils;
  * will have to block only when processing large messages and the shared buffer
  * fills up. It is generally advisable to allocate shared buffers of a size of
  * an average content body for optimal performance.
- *
- * @see NIOReactorPNames#CONTENT_BUFFER_SIZE
- *
+ * <p>
+ * The following parameters can be used to customize the behavior of this
+ * class:
+ * <ul>
+ *  <li>{@link org.apache.http.nio.params.NIOReactorPNames#CONTENT_BUFFER_SIZE}</li>
+ *  <li>{@link org.apache.http.params.CoreProtocolPNames#WAIT_FOR_CONTINUE}</li>
+ * </ul>
  *
  * @since 4.0
+ * @deprecated Use {@link AsyncNHttpServiceHandler}
  */
+@Deprecated
 @ThreadSafe // provided injected dependencies are immutable or thread safe
 public class ThrottlingHttpServiceHandler extends NHttpHandlerBase
                                           implements NHttpServiceHandler {
@@ -111,6 +117,8 @@ public class ThrottlingHttpServiceHandle
     protected HttpRequestHandlerResolver handlerResolver;
     protected HttpExpectationVerifier expectationVerifier;
 
+    private final int bufsize;
+
     public ThrottlingHttpServiceHandler(
             final HttpProcessor httpProcessor,
             final HttpResponseFactory responseFactory,
@@ -127,6 +135,7 @@ public class ThrottlingHttpServiceHandle
         }
         this.responseFactory = responseFactory;
         this.executor = executor;
+        this.bufsize = this.params.getIntParameter(NIOReactorPNames.CONTENT_BUFFER_SIZE, 20480);
     }
 
     public ThrottlingHttpServiceHandler(
@@ -150,9 +159,7 @@ public class ThrottlingHttpServiceHandle
     public void connected(final NHttpServerConnection conn) {
         HttpContext context = conn.getContext();
 
-        int bufsize = this.params.getIntParameter(
-                NIOReactorPNames.CONTENT_BUFFER_SIZE, 20480);
-        ServerConnState connState = new ServerConnState(bufsize, conn, allocator);
+        ServerConnState connState = new ServerConnState(this.bufsize, conn, allocator);
         context.setAttribute(CONN_STATE, connState);
 
         if (this.eventListener != 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=1157038&r1=1157037&r2=1157038&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 Fri Aug 12 10:35:32 2011
@@ -28,10 +28,8 @@ package org.apache.http.impl.nio.pool;
 
 
 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.HttpParams;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -41,9 +39,8 @@ import org.mockito.MockitoAnnotations;
 public class TestBasicNIOConnPool {
 
     private BasicNIOConnPool pool;
-    @Mock private ConnectingIOReactor reactor;
-    @Mock private HttpParams params;
     private HttpHost route;
+    @Mock private ConnectingIOReactor reactor;
     @Mock private IOSession session;
 
     @Before
@@ -52,7 +49,7 @@ public class TestBasicNIOConnPool {
 
         route = new HttpHost("localhost", 80, "http");
 
-        pool = new BasicNIOConnPool(reactor, params);
+        pool = new BasicNIOConnPool(reactor);
     }
 
     @After
@@ -61,7 +58,7 @@ public class TestBasicNIOConnPool {
 
     @Test(expected=IllegalArgumentException.class)
     public void testNullConstructor() throws Exception {
-        pool = new BasicNIOConnPool(null, null);
+        pool = new BasicNIOConnPool(null);
     }
 
     @Test
@@ -71,7 +68,7 @@ public class TestBasicNIOConnPool {
 
     @Test
     public void testCreateEntry() throws Exception {
-        NHttpClientConnection conn = pool.createConnection(route, session);
+        IOSession conn = pool.createConnection(route, session);
         BasicNIOPoolEntry entry = pool.createEntry(route, conn);
 
         pool.closeEntry(entry);

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=1157038&r1=1157037&r2=1157038&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 Fri Aug 12 10:35:32 2011
@@ -82,7 +82,9 @@ public class TestDefaultListeningIOReact
                 serviceHandler,
                 params);
 
-        final ListeningIOReactor ioreactor = new DefaultListeningIOReactor(1, params);
+        IOReactorConfig config = new IOReactorConfig();
+        config.setIoThreadCount(1);
+        final ListeningIOReactor ioreactor = new DefaultListeningIOReactor(config);
 
         Thread t = new Thread(new Runnable() {
 
@@ -149,7 +151,9 @@ public class TestDefaultListeningIOReact
                 serviceHandler,
                 params);
 
-        final ListeningIOReactor ioreactor = new DefaultListeningIOReactor(1, params);
+        IOReactorConfig config = new IOReactorConfig();
+        config.setIoThreadCount(1);
+        final ListeningIOReactor ioreactor = new DefaultListeningIOReactor(config);
 
         final CountDownLatch latch = new CountDownLatch(1);
 
@@ -211,7 +215,9 @@ public class TestDefaultListeningIOReact
                 serviceHandler,
                 params);
 
-        final DefaultListeningIOReactor ioreactor = new DefaultListeningIOReactor(1, params);
+        IOReactorConfig config = new IOReactorConfig();
+        config.setIoThreadCount(1);
+        final DefaultListeningIOReactor ioreactor = new DefaultListeningIOReactor(config);
 
         ioreactor.setExceptionHandler(new IOReactorExceptionHandler() {
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestThrottlingNHttpHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestThrottlingNHttpHandlers.java?rev=1157038&r1=1157037&r2=1157038&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestThrottlingNHttpHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestThrottlingNHttpHandlers.java Fri Aug 12 10:35:32 2011
@@ -90,12 +90,14 @@ import org.apache.http.util.EncodingUtil
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  * HttpCore NIO integration tests using throttling versions of the
  * protocol handlers.
  */
+@Deprecated
 public class TestThrottlingNHttpHandlers extends HttpCoreNIOTestBase {
 
     private ExecutorService execService;
@@ -275,7 +277,7 @@ public class TestThrottlingNHttpHandlers
      * (under the control of a ThrottlingHttpServiceHandler)
      * terminates when a connection timeout occurs.
      */
-    @Test
+    @Test @Ignore
     public void testExecutorTermination() throws Exception {
         final int SHORT_TIMEOUT = 100;
         final int DEFAULT_SERVER_SO_TIMEOUT = 60000;



Mime
View raw message