hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1763199 [1/2] - in /httpcomponents/httpcore/trunk: httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/ httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/ httpcore5-h2/src/main/java/org/apache/hc/core5/http2/imp...
Date Mon, 03 Oct 2016 19:28:21 GMT
Author: olegk
Date: Mon Oct  3 19:28:20 2016
New Revision: 1763199

URL: http://svn.apache.org/viewvc?rev=1763199&view=rev
Log:
New async server and client bootstrap

Added:
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncRequester.java   (with props)
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncServer.java
      - copied, changed from r1762693, httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/IOReactorExecutor.java   (with props)
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionListener.java   (contents, props changed)
      - copied, changed from r1762693, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionLogger.java
Removed:
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionLogger.java
Modified:
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2IOEventHandler.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiator.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiatorFactory.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2IOEventHandler.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiatorFactory.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2IntegrationTest.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestClient.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestServer.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalClientHttp2EventHandlerFactory.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalServerHttp2EventHandlerFactory.java
    httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/HttpFileServer.java
    httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/NHttpFileServer.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/HttpServer.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/RequestListener.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/ServerBootstrap.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/Worker.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/HttpServer.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/ServerBootstrap.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequester.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpServer.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/HttpServerNio.java

Added: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncRequester.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncRequester.java?rev=1763199&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncRequester.java (added)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncRequester.java Mon Oct  3 19:28:20 2016
@@ -0,0 +1,103 @@
+/*
+ * ====================================================================
+ * 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.hc.core5.http2.bootstrap.nio;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketTimeoutException;
+import java.util.concurrent.Future;
+
+import org.apache.hc.core5.concurrent.BasicFuture;
+import org.apache.hc.core5.concurrent.FutureCallback;
+import org.apache.hc.core5.http.ExceptionListener;
+import org.apache.hc.core5.http2.nio.command.ClientCommandEndpoint;
+import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
+import org.apache.hc.core5.reactor.IOEventHandlerFactory;
+import org.apache.hc.core5.reactor.IOSession;
+import org.apache.hc.core5.reactor.SessionRequest;
+import org.apache.hc.core5.reactor.SessionRequestCallback;
+import org.apache.hc.core5.util.Args;
+
+public class AsyncRequester extends IOReactorExecutor<DefaultConnectingIOReactor> {
+
+    public AsyncRequester(final ExceptionListener exceptionListener) throws IOException {
+        super(exceptionListener);
+    }
+
+    protected void start(final IOEventHandlerFactory ioEventHandlerFactory) throws IOException {
+        Args.notNull(ioEventHandlerFactory, "Handler factory");
+        startExecution(new DefaultConnectingIOReactor(ioEventHandlerFactory));
+    }
+
+    public Future<ClientCommandEndpoint> connect(
+            final InetSocketAddress address,
+            final int connectTimeout,
+            final Object attachment,
+            final FutureCallback<ClientCommandEndpoint> callback) throws InterruptedException {
+        final BasicFuture<ClientCommandEndpoint> future = new BasicFuture<>(callback);
+        final SessionRequest sessionRequest = reactor().connect(address, null, attachment, new SessionRequestCallback() {
+
+            @Override
+            public void completed(final SessionRequest request) {
+                final IOSession session = request.getSession();
+                future.completed(new ClientCommandEndpoint(session));
+            }
+
+            @Override
+            public void failed(final SessionRequest request) {
+                future.failed(request.getException());
+            }
+
+            @Override
+            public void timeout(final SessionRequest request) {
+                future.failed(new SocketTimeoutException("Connect timeout"));
+            }
+
+            @Override
+            public void cancelled(final SessionRequest request) {
+                future.cancel();
+            }
+        });
+        sessionRequest.setConnectTimeout(connectTimeout);
+        return future;
+    }
+
+    public Future<ClientCommandEndpoint> connect(
+            final InetSocketAddress address,
+            final int connectTimeout) throws InterruptedException {
+        return connect(address, connectTimeout, null, null);
+    }
+
+    public Future<ClientCommandEndpoint> connect(
+            final String hostname,
+            final int port,
+            final int connectTimeout) throws InterruptedException {
+        return connect(new InetSocketAddress(hostname, port), connectTimeout, null, null);
+    }
+
+}

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncRequester.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncRequester.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncRequester.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncServer.java (from r1762693, httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncServer.java?p2=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncServer.java&p1=httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java&r1=1762693&r2=1763199&rev=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/AsyncServer.java Mon Oct  3 19:28:20 2016
@@ -25,25 +25,30 @@
  *
  */
 
-package org.apache.hc.core5.http2.integration;
+package org.apache.hc.core5.http2.bootstrap.nio;
 
-import org.apache.commons.logging.Log;
-import org.apache.hc.core5.http.ConnectionClosedException;
-import org.apache.hc.core5.http2.impl.nio.HttpErrorListener;
+import java.io.IOException;
+import java.net.InetSocketAddress;
 
-class InternalHttpErrorListener implements HttpErrorListener {
+import org.apache.hc.core5.http.ExceptionListener;
+import org.apache.hc.core5.reactor.DefaultListeningIOReactor;
+import org.apache.hc.core5.reactor.IOEventHandlerFactory;
+import org.apache.hc.core5.reactor.ListenerEndpoint;
+import org.apache.hc.core5.util.Args;
 
-    private final Log log;
+public class AsyncServer extends IOReactorExecutor<DefaultListeningIOReactor> {
 
-    public InternalHttpErrorListener(final Log log) {
-        this.log = log;
+    public AsyncServer(final ExceptionListener exceptionListener) throws IOException {
+        super(exceptionListener);
     }
 
-    @Override
-    public void onError(final Exception cause) {
-        if (log != null && !(cause instanceof ConnectionClosedException)) {
-            log.error(cause.getMessage(), cause);
-        }
+    protected void start(final IOEventHandlerFactory ioEventHandlerFactory) throws Exception {
+        Args.notNull(ioEventHandlerFactory, "Handler factory");
+        startExecution(new DefaultListeningIOReactor(ioEventHandlerFactory));
+    }
+
+    public ListenerEndpoint listen(final InetSocketAddress address) {
+        return reactor().listen(address);
     }
 
 }

Added: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/IOReactorExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/IOReactorExecutor.java?rev=1763199&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/IOReactorExecutor.java (added)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/IOReactorExecutor.java Mon Oct  3 19:28:20 2016
@@ -0,0 +1,120 @@
+/*
+ * ====================================================================
+ * 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.hc.core5.http2.bootstrap.nio;
+
+import java.io.IOException;
+import java.nio.channels.SelectionKey;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hc.core5.http.ExceptionListener;
+import org.apache.hc.core5.http2.nio.command.ShutdownCommand;
+import org.apache.hc.core5.http2.nio.command.ShutdownType;
+import org.apache.hc.core5.reactor.AbstractMultiworkerIOReactor;
+import org.apache.hc.core5.reactor.ExceptionEvent;
+import org.apache.hc.core5.reactor.IOReactorStatus;
+import org.apache.hc.core5.reactor.IOSession;
+import org.apache.hc.core5.reactor.IOSessionCallback;
+import org.apache.hc.core5.util.Asserts;
+
+class IOReactorExecutor<T extends AbstractMultiworkerIOReactor> {
+
+    private final ExceptionListener exceptionListener;
+    private final ExecutorService executorService;
+
+    private volatile T ioReactor;
+
+    public IOReactorExecutor(final ExceptionListener exceptionListener) {
+        super();
+        this.exceptionListener = exceptionListener;
+        this.executorService = Executors.newSingleThreadExecutor();
+    }
+
+    void startExecution(final T reactor) {
+        Asserts.check(ioReactor == null, "I/O reactor has already been started");
+        ioReactor = reactor;
+        executorService.execute(new Runnable() {
+
+            @Override
+            public void run() {
+                try {
+                    ioReactor.execute();
+                } catch (Exception ex) {
+                    if (exceptionListener != null) {
+                        exceptionListener.onError(ex);
+                    }
+                }
+            }
+        });
+    }
+
+    private T ensureRunning() {
+        Asserts.check(ioReactor != null, "I/O reactor has not been started");
+        return ioReactor;
+    }
+
+    T reactor() {
+        return ensureRunning();
+    }
+
+    public IOReactorStatus getStatus() {
+        return this.ioReactor.getStatus();
+    }
+
+    public List<ExceptionEvent> getAuditLog() {
+        return this.ioReactor.getAuditLog();
+    }
+
+    public void awaitShutdown(final long deadline, final TimeUnit timeUnit) throws InterruptedException {
+        ensureRunning();
+        ioReactor.awaitShutdown(deadline, timeUnit);
+    }
+
+    public void initiateShutdown() throws IOException {
+        ensureRunning();
+        ioReactor.initiateShutdown();
+        ioReactor.enumSessions(new IOSessionCallback() {
+
+            @Override
+            public void execute(final IOSession session) throws IOException {
+                session.getCommandQueue().addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
+                session.setEvent(SelectionKey.OP_WRITE);
+            }
+
+        });
+    }
+
+    public void shutdown(final long graceTime, final TimeUnit timeUnit) throws IOException {
+        ensureRunning();
+        initiateShutdown();
+        ioReactor.shutdown(graceTime, timeUnit);
+    }
+
+}

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/IOReactorExecutor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/IOReactorExecutor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/bootstrap/nio/IOReactorExecutor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java Mon Oct  3 19:28:20 2016
@@ -27,6 +27,7 @@
 
 package org.apache.hc.core5.http2.impl.nio;
 
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.reactor.IOEventHandler;
 import org.apache.hc.core5.reactor.IOSession;
 import org.apache.hc.core5.util.Args;
@@ -34,9 +35,9 @@ import org.apache.hc.core5.util.Args;
 class AbstractHttp2IOEventHandler implements IOEventHandler {
 
     private final AbstractHttp2StreamMultiplexer streamMultiplexer;
-    private final HttpErrorListener errorListener;
+    private final ExceptionListener errorListener;
 
-    AbstractHttp2IOEventHandler(final AbstractHttp2StreamMultiplexer streamMultiplexer, final HttpErrorListener errorListener) {
+    AbstractHttp2IOEventHandler(final AbstractHttp2StreamMultiplexer streamMultiplexer, final ExceptionListener errorListener) {
         this.streamMultiplexer = Args.notNull(streamMultiplexer, "Stream multiplexer");
         this.errorListener = errorListener;
     }

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2IOEventHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2IOEventHandler.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2IOEventHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2IOEventHandler.java Mon Oct  3 19:28:20 2016
@@ -29,6 +29,7 @@ package org.apache.hc.core5.http2.impl.n
 
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ExceptionListener;
 
 /**
  * {@link org.apache.hc.core5.reactor.IOEventHandler} that implements client side HTTP/2 messaging protocol.
@@ -38,7 +39,7 @@ import org.apache.hc.core5.annotation.Th
 @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
 public class ClientHttp2IOEventHandler extends AbstractHttp2IOEventHandler {
 
-    public ClientHttp2IOEventHandler(final ClientHttp2StreamMultiplexer streamMultiplexer, final HttpErrorListener errorListener) {
+    public ClientHttp2IOEventHandler(final ClientHttp2StreamMultiplexer streamMultiplexer, final ExceptionListener errorListener) {
         super(streamMultiplexer, errorListener);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiator.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiator.java Mon Oct  3 19:28:20 2016
@@ -35,6 +35,7 @@ import java.nio.charset.StandardCharsets
 
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.H2ConnectionException;
 import org.apache.hc.core5.http2.H2Error;
@@ -63,7 +64,7 @@ public class ClientHttpProtocolNegotiato
     private final H2Config h2Config;
     private final HandlerFactory<AsyncPushConsumer> pushHandlerFactory;
     private final Http2StreamListener streamListener;
-    private final HttpErrorListener errorListener;
+    private final ExceptionListener errorListener;
 
     public ClientHttpProtocolNegotiator(
             final HttpProcessor httpProcessor,
@@ -71,7 +72,7 @@ public class ClientHttpProtocolNegotiato
             final Charset charset,
             final H2Config h2Config,
             final Http2StreamListener streamListener,
-            final HttpErrorListener errorListener) {
+            final ExceptionListener errorListener) {
         this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
         this.pushHandlerFactory = pushHandlerFactory;
         this.charset = charset != null ? charset : StandardCharsets.US_ASCII;

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiatorFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiatorFactory.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiatorFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiatorFactory.java Mon Oct  3 19:28:20 2016
@@ -32,6 +32,7 @@ import java.nio.charset.StandardCharsets
 
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.config.H2Config;
 import org.apache.hc.core5.http2.nio.AsyncPushConsumer;
@@ -51,7 +52,7 @@ public class ClientHttpProtocolNegotiato
     private final Charset charset;
     private final H2Config h2Config;
     private final Http2StreamListener streamListener;
-    private final HttpErrorListener errorListener;
+    private final ExceptionListener errorListener;
 
     public ClientHttpProtocolNegotiatorFactory(
             final HttpProcessor httpProcessor,
@@ -59,7 +60,7 @@ public class ClientHttpProtocolNegotiato
             final Charset charset,
             final H2Config h2Config,
             final Http2StreamListener streamListener,
-            final HttpErrorListener errorListener) {
+            final ExceptionListener errorListener) {
         this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
         this.pushHandlerFactory = pushHandlerFactory;
         this.charset = charset != null ? charset : StandardCharsets.US_ASCII;
@@ -72,14 +73,14 @@ public class ClientHttpProtocolNegotiato
             final HttpProcessor httpProcessor,
             final HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
             final Http2StreamListener streamListener,
-            final HttpErrorListener errorListener) {
+            final ExceptionListener errorListener) {
         this(httpProcessor, pushHandlerFactory, null, null, streamListener, errorListener);
     }
 
     public ClientHttpProtocolNegotiatorFactory(
             final HttpProcessor httpProcessor,
             final Http2StreamListener streamListener,
-            final HttpErrorListener errorListener) {
+            final ExceptionListener errorListener) {
         this(httpProcessor, null, streamListener, errorListener);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2IOEventHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2IOEventHandler.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2IOEventHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2IOEventHandler.java Mon Oct  3 19:28:20 2016
@@ -29,6 +29,7 @@ package org.apache.hc.core5.http2.impl.n
 
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ExceptionListener;
 
 /**
  * {@link org.apache.hc.core5.reactor.IOEventHandler} that implements server side HTTP/2 messaging protocol.
@@ -38,7 +39,7 @@ import org.apache.hc.core5.annotation.Th
 @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
 public class ServerHttp2IOEventHandler extends AbstractHttp2IOEventHandler{
 
-    public ServerHttp2IOEventHandler(final ServerHttp2StreamMultiplexer streamMultiplexer, final HttpErrorListener errorListener) {
+    public ServerHttp2IOEventHandler(final ServerHttp2StreamMultiplexer streamMultiplexer, final ExceptionListener errorListener) {
         super(streamMultiplexer, errorListener);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java Mon Oct  3 19:28:20 2016
@@ -34,6 +34,7 @@ import java.nio.charset.StandardCharsets
 
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.H2ConnectionException;
 import org.apache.hc.core5.http2.H2Error;
@@ -58,7 +59,7 @@ public class ServerHttpProtocolNegotiato
     private final Charset charset;
     private final H2Config h2Config;
     private final Http2StreamListener streamListener;
-    private final HttpErrorListener errorListener;
+    private final ExceptionListener errorListener;
     private final ByteBuffer bytebuf;
 
     public ServerHttpProtocolNegotiator(
@@ -67,7 +68,7 @@ public class ServerHttpProtocolNegotiato
             final Charset charset,
             final H2Config h2Config,
             final Http2StreamListener streamListener,
-            final HttpErrorListener errorListener) {
+            final ExceptionListener errorListener) {
         this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
         this.exchangeHandlerFactory = Args.notNull(exchangeHandlerFactory, "Exchange handler factory");
         this.charset = charset != null ? charset : StandardCharsets.US_ASCII;

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiatorFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiatorFactory.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiatorFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiatorFactory.java Mon Oct  3 19:28:20 2016
@@ -32,6 +32,7 @@ import java.nio.charset.StandardCharsets
 
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.config.H2Config;
 import org.apache.hc.core5.http2.nio.AsyncServerExchangeHandler;
@@ -51,7 +52,7 @@ public class ServerHttpProtocolNegotiato
     private final Charset charset;
     private final H2Config h2Config;
     private final Http2StreamListener streamListener;
-    private final HttpErrorListener errorListener;
+    private final ExceptionListener errorListener;
 
     public ServerHttpProtocolNegotiatorFactory(
             final HttpProcessor httpProcessor,
@@ -59,7 +60,7 @@ public class ServerHttpProtocolNegotiato
             final Charset charset,
             final H2Config h2Config,
             final Http2StreamListener streamListener,
-            final HttpErrorListener errorListener) {
+            final ExceptionListener errorListener) {
         this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
         this.exchangeHandlerFactory = Args.notNull(exchangeHandlerFactory, "Exchange handler factory");
         this.charset = charset != null ? charset : StandardCharsets.US_ASCII;
@@ -72,7 +73,7 @@ public class ServerHttpProtocolNegotiato
             final HttpProcessor httpProcessor,
             final HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory,
             final Http2StreamListener streamListener,
-            final HttpErrorListener errorListener) {
+            final ExceptionListener errorListener) {
         this(httpProcessor, exchangeHandlerFactory, null, null, streamListener, errorListener);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2IntegrationTest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2IntegrationTest.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2IntegrationTest.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2IntegrationTest.java Mon Oct  3 19:28:20 2016
@@ -463,8 +463,6 @@ public class Http2IntegrationTest extend
         final Future<ClientCommandEndpoint> connectFuture = client.connect("localhost", serverEndpoint.getPort(), 5000);
         final ClientCommandEndpoint streamEndpoint = connectFuture.get();
 
-        client.start();
-
         final HttpRequest request1 = new BasicHttpRequest("POST", createRequestURI(serverEndpoint, "/echo"));
         final Future<Message<HttpResponse, String>> future1 = streamEndpoint.execute(
                 new BasicRequestProducer(request1, new MultiLineEntityProducer("0123456789abcdef", 5000)),
@@ -904,8 +902,6 @@ public class Http2IntegrationTest extend
         final Future<ClientCommandEndpoint> connectFuture = client.connect("localhost", serverEndpoint.getPort(), 5000);
         final ClientCommandEndpoint streamEndpoint = connectFuture.get();
 
-        client.start();
-
         final HttpRequest request1 = new BasicHttpRequest("POST", createRequestURI(serverEndpoint, "/echo"));
         request1.addHeader("password", "secret");
         final Future<Message<HttpResponse, String>> future1 = streamEndpoint.execute(
@@ -1015,8 +1011,6 @@ public class Http2IntegrationTest extend
         final Future<ClientCommandEndpoint> connectFuture = client.connect("localhost", serverEndpoint.getPort(), 5000);
         final ClientCommandEndpoint streamEndpoint = connectFuture.get();
 
-        client.start();
-
         final HttpRequest request1 = new BasicHttpRequest("POST", createRequestURI(serverEndpoint, "/echo"));
         final Future<Message<HttpResponse, String>> future1 = streamEndpoint.execute(
                 new BasicRequestProducer(request1, new MultiLineEntityProducer("0123456789abcdef", 5000)),

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestClient.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestClient.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestClient.java Mon Oct  3 19:28:20 2016
@@ -28,21 +28,13 @@
 package org.apache.hc.core5.http2.integration;
 
 import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.SocketTimeoutException;
-import java.nio.channels.SelectionKey;
 import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
 
-import org.apache.hc.core5.concurrent.BasicFuture;
-import org.apache.hc.core5.concurrent.FutureCallback;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http2.bootstrap.nio.AsyncRequester;
 import org.apache.hc.core5.http.protocol.DefaultHttpProcessor;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
@@ -55,82 +47,20 @@ import org.apache.hc.core5.http2.config.
 import org.apache.hc.core5.http2.nio.AsyncPushConsumer;
 import org.apache.hc.core5.http2.nio.HandlerFactory;
 import org.apache.hc.core5.http2.nio.Supplier;
-import org.apache.hc.core5.http2.nio.command.ClientCommandEndpoint;
-import org.apache.hc.core5.http2.nio.command.ShutdownCommand;
-import org.apache.hc.core5.http2.nio.command.ShutdownType;
 import org.apache.hc.core5.http2.protocol.H2RequestConnControl;
 import org.apache.hc.core5.http2.protocol.H2RequestContent;
 import org.apache.hc.core5.http2.protocol.H2RequestTargetHost;
-import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
-import org.apache.hc.core5.reactor.ExceptionEvent;
-import org.apache.hc.core5.reactor.IOReactorExceptionHandler;
-import org.apache.hc.core5.reactor.IOReactorStatus;
-import org.apache.hc.core5.reactor.IOSession;
-import org.apache.hc.core5.reactor.IOSessionCallback;
-import org.apache.hc.core5.reactor.SessionRequest;
-import org.apache.hc.core5.reactor.SessionRequestCallback;
 import org.apache.hc.core5.util.Args;
 
-public class Http2TestClient {
+public class Http2TestClient extends AsyncRequester {
 
-    private final ExecutorService executorService;
     private final UriPatternMatcher<Supplier<AsyncPushConsumer>> pushHandlerMatcher;
 
-    private volatile DefaultConnectingIOReactor ioReactor;
-    private volatile Exception exception;
-
     public Http2TestClient() throws IOException {
-        super();
-        this.executorService = Executors.newSingleThreadExecutor();
+        super(new InternalHttpErrorListener(LogFactory.getLog(Http2TestClient.class)));
         this.pushHandlerMatcher = new UriPatternMatcher<>();
     }
 
-    public Future<ClientCommandEndpoint> connect(
-            final InetSocketAddress address,
-            final int connectTimeout,
-            final Object attachment,
-            final FutureCallback<ClientCommandEndpoint> callback) throws InterruptedException {
-        final BasicFuture<ClientCommandEndpoint> future = new BasicFuture<>(callback);
-        final SessionRequest sessionRequest = this.ioReactor.connect(address, null, attachment, new SessionRequestCallback() {
-
-            @Override
-            public void completed(final SessionRequest request) {
-                final IOSession session = request.getSession();
-                future.completed(new ClientCommandEndpoint(session));
-            }
-
-            @Override
-            public void failed(final SessionRequest request) {
-                future.failed(request.getException());
-            }
-
-            @Override
-            public void timeout(final SessionRequest request) {
-                future.failed(new SocketTimeoutException("Connect timeout"));
-            }
-
-            @Override
-            public void cancelled(final SessionRequest request) {
-                future.cancel();
-            }
-        });
-        sessionRequest.setConnectTimeout(connectTimeout);
-        return future;
-    }
-
-    public Future<ClientCommandEndpoint> connect(
-            final InetSocketAddress address,
-            final int connectTimeout) throws InterruptedException {
-        return connect(address, connectTimeout, null, null);
-    }
-
-    public Future<ClientCommandEndpoint> connect(
-            final String hostname,
-            final int port,
-            final int connectTimeout) throws InterruptedException {
-        return connect(new InetSocketAddress(hostname, port), connectTimeout, null, null);
-    }
-
     private AsyncPushConsumer createHandler(final HttpRequest request) throws HttpException, IOException {
 
         final HttpHost authority;
@@ -165,14 +95,14 @@ public class Http2TestClient {
         start(H2Config.DEFAULT);
     }
 
-    public void start(final H2Config h2Config) throws Exception {
+    public void start(final H2Config h2Config) throws IOException {
         final HttpProcessor httpProcessor = new DefaultHttpProcessor(
                 new H2RequestContent(),
                 new H2RequestTargetHost(),
                 new H2RequestConnControl(),
                 new RequestUserAgent("TEST-CLIENT/1.1"),
                 new RequestExpectContinue());
-        this.ioReactor = new DefaultConnectingIOReactor(new InternalClientHttp2EventHandlerFactory(
+        start(new InternalClientHttp2EventHandlerFactory(
                 httpProcessor,
                 new HandlerFactory<AsyncPushConsumer>() {
 
@@ -185,66 +115,6 @@ public class Http2TestClient {
                 },
                 StandardCharsets.US_ASCII,
                 h2Config));
-        ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
-
-            @Override
-            public boolean handle(final IOException ex) {
-                ex.printStackTrace();
-                return false;
-            }
-
-            @Override
-            public boolean handle(final RuntimeException ex) {
-                ex.printStackTrace();
-                return false;
-            }
-
-        });
-        this.executorService.execute(new Runnable() {
-
-            @Override
-            public void run() {
-                try {
-                    ioReactor.execute();
-                } catch (Exception ex) {
-                    exception = ex;
-                }
-            }
-        });
-    }
-
-    public IOReactorStatus getStatus() {
-        return this.ioReactor.getStatus();
-    }
-
-    public List<ExceptionEvent> getAuditLog() {
-        return this.ioReactor.getAuditLog();
-    }
-
-    public Exception getException() {
-        return this.exception;
-    }
-
-    public void awaitShutdown(final long deadline, final TimeUnit timeUnit) throws InterruptedException {
-        ioReactor.awaitShutdown(deadline, timeUnit);
-    }
-
-    public void initiateShutdown() throws IOException {
-        ioReactor.initiateShutdown();
-        ioReactor.enumSessions(new IOSessionCallback() {
-
-            @Override
-            public void execute(final IOSession session) throws IOException {
-                session.getCommandQueue().addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
-                session.setEvent(SelectionKey.OP_WRITE);
-            }
-
-        });
-    }
-
-    public void shutdown(final long graceTime, final TimeUnit timeUnit) throws IOException {
-        initiateShutdown();
-        ioReactor.shutdown(graceTime, timeUnit);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestServer.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestServer.java Mon Oct  3 19:28:20 2016
@@ -29,19 +29,16 @@ package org.apache.hc.core5.http2.integr
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
-import java.nio.channels.SelectionKey;
 import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
 
+import org.apache.commons.logging.LogFactory;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpRequestInterceptor;
 import org.apache.hc.core5.http.HttpResponseInterceptor;
 import org.apache.hc.core5.http.HttpStatus;
+import org.apache.hc.core5.http2.bootstrap.nio.AsyncServer;
 import org.apache.hc.core5.http.protocol.DefaultHttpProcessor;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
@@ -53,31 +50,18 @@ import org.apache.hc.core5.http2.nio.Asy
 import org.apache.hc.core5.http2.nio.FixedResponseExchangeHandler;
 import org.apache.hc.core5.http2.nio.HandlerFactory;
 import org.apache.hc.core5.http2.nio.Supplier;
-import org.apache.hc.core5.http2.nio.command.ShutdownCommand;
-import org.apache.hc.core5.http2.nio.command.ShutdownType;
 import org.apache.hc.core5.http2.protocol.H2RequestValidateHost;
 import org.apache.hc.core5.http2.protocol.H2ResponseConnControl;
 import org.apache.hc.core5.http2.protocol.H2ResponseContent;
-import org.apache.hc.core5.reactor.DefaultListeningIOReactor;
-import org.apache.hc.core5.reactor.ExceptionEvent;
-import org.apache.hc.core5.reactor.IOReactorExceptionHandler;
-import org.apache.hc.core5.reactor.IOReactorStatus;
-import org.apache.hc.core5.reactor.IOSession;
-import org.apache.hc.core5.reactor.IOSessionCallback;
 import org.apache.hc.core5.reactor.ListenerEndpoint;
 import org.apache.hc.core5.util.Args;
 
-public class Http2TestServer {
+public class Http2TestServer extends AsyncServer {
 
-    private final ExecutorService executorService;
     private final UriPatternMatcher<Supplier<AsyncServerExchangeHandler>> responseHandlerMatcher;
 
-    private volatile DefaultListeningIOReactor ioReactor;
-    private volatile Exception exception;
-
     public Http2TestServer() throws IOException {
-        super();
-        this.executorService = Executors.newSingleThreadExecutor();
+        super(new InternalHttpErrorListener(LogFactory.getLog(Http2TestClient.class)));
         this.responseHandlerMatcher = new UriPatternMatcher<>();
     }
 
@@ -125,7 +109,7 @@ public class Http2TestServer {
                         new H2ResponseContent(),
                         new H2ResponseConnControl()
                 });
-        ioReactor = new DefaultListeningIOReactor(new InternalServerHttp2EventHandlerFactory(
+        start(new InternalServerHttp2EventHandlerFactory(
                 httpProcessor,
                 new HandlerFactory<AsyncServerExchangeHandler>() {
 
@@ -139,69 +123,9 @@ public class Http2TestServer {
                 },
                 StandardCharsets.US_ASCII,
                 h2Config));
-        ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
-
-            @Override
-            public boolean handle(final IOException ex) {
-                ex.printStackTrace();
-                return false;
-            }
-
-            @Override
-            public boolean handle(final RuntimeException ex) {
-                ex.printStackTrace();
-                return false;
-            }
-
-        });
-        executorService.execute(new Runnable() {
-
-            @Override
-            public void run() {
-                try {
-                    ioReactor.execute();
-                } catch (Exception ex) {
-                    exception = ex;
-                }
-            }
-        });
-        final ListenerEndpoint listener = ioReactor.listen(new InetSocketAddress(0));
+        final ListenerEndpoint listener = listen(new InetSocketAddress(0));
         listener.waitFor();
         return (InetSocketAddress) listener.getAddress();
     }
 
-    public IOReactorStatus getStatus() {
-        return this.ioReactor.getStatus();
-    }
-
-    public List<ExceptionEvent> getAuditLog() {
-        return this.ioReactor.getAuditLog();
-    }
-
-    public Exception getException() {
-        return this.exception;
-    }
-
-    public void awaitShutdown(final long deadline, final TimeUnit timeUnit) throws InterruptedException {
-        ioReactor.awaitShutdown(deadline, timeUnit);
-    }
-
-    public void initiateShutdown() throws IOException {
-        ioReactor.initiateShutdown();
-        ioReactor.enumSessions(new IOSessionCallback() {
-
-            @Override
-            public void execute(final IOSession session) throws IOException {
-                session.getCommandQueue().addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
-                session.setEvent(SelectionKey.OP_WRITE);
-            }
-
-        });
-    }
-
-    public void shutdown(final long graceTime, final TimeUnit timeUnit) throws IOException {
-        initiateShutdown();
-        ioReactor.shutdown(graceTime, timeUnit);
-    }
-
 }

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalClientHttp2EventHandlerFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalClientHttp2EventHandlerFactory.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalClientHttp2EventHandlerFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalClientHttp2EventHandlerFactory.java Mon Oct  3 19:28:20 2016
@@ -32,11 +32,11 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.config.H2Config;
 import org.apache.hc.core5.http2.impl.nio.ClientHttp2StreamMultiplexer;
 import org.apache.hc.core5.http2.impl.nio.ClientHttpProtocolNegotiator;
-import org.apache.hc.core5.http2.impl.nio.HttpErrorListener;
 import org.apache.hc.core5.http2.nio.AsyncPushConsumer;
 import org.apache.hc.core5.http2.nio.HandlerFactory;
 import org.apache.hc.core5.reactor.IOEventHandler;
@@ -69,7 +69,7 @@ public class InternalClientHttp2EventHan
         final String id = "http2-outgoing-" + COUNT.incrementAndGet();
         final Log sessionLog = LogFactory.getLog(ioSession.getClass());
         final InternalHttp2StreamListener streamListener = new InternalHttp2StreamListener(id);
-        final HttpErrorListener errorListener = new InternalHttpErrorListener(sessionLog);
+        final ExceptionListener errorListener = new InternalHttpErrorListener(sessionLog);
         return new ClientHttpProtocolNegotiator(httpProcessor, exchangeHandlerFactory, charset, h2Config, streamListener, errorListener) {
 
             @Override

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java Mon Oct  3 19:28:20 2016
@@ -29,9 +29,9 @@ package org.apache.hc.core5.http2.integr
 
 import org.apache.commons.logging.Log;
 import org.apache.hc.core5.http.ConnectionClosedException;
-import org.apache.hc.core5.http2.impl.nio.HttpErrorListener;
+import org.apache.hc.core5.http.ExceptionListener;
 
-class InternalHttpErrorListener implements HttpErrorListener {
+class InternalHttpErrorListener implements ExceptionListener {
 
     private final Log log;
 

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalServerHttp2EventHandlerFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalServerHttp2EventHandlerFactory.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalServerHttp2EventHandlerFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalServerHttp2EventHandlerFactory.java Mon Oct  3 19:28:20 2016
@@ -32,9 +32,9 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.config.H2Config;
-import org.apache.hc.core5.http2.impl.nio.HttpErrorListener;
 import org.apache.hc.core5.http2.impl.nio.ServerHttp2StreamMultiplexer;
 import org.apache.hc.core5.http2.impl.nio.ServerHttpProtocolNegotiator;
 import org.apache.hc.core5.http2.nio.AsyncServerExchangeHandler;
@@ -69,7 +69,7 @@ public class InternalServerHttp2EventHan
         final String id = "http2-incoming-" + COUNT.incrementAndGet();
         final Log sessionLog = LogFactory.getLog(ioSession.getClass());
         final InternalHttp2StreamListener streamListener = new InternalHttp2StreamListener(id);
-        final HttpErrorListener errorListener = new InternalHttpErrorListener(sessionLog);
+        final ExceptionListener errorListener = new InternalHttpErrorListener(sessionLog);
         return new ServerHttpProtocolNegotiator(httpProcessor, exchangeHandlerFactory, charset, h2Config, streamListener, errorListener) {
 
             @Override

Modified: httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/HttpFileServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/HttpFileServer.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/HttpFileServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/HttpFileServer.java Mon Oct  3 19:28:20 2016
@@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit;
 import javax.net.ssl.SSLContext;
 
 import org.apache.hc.core5.http.ConnectionClosedException;
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.HttpConnection;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
@@ -99,7 +99,7 @@ public class HttpFileServer {
                 .setServerInfo("Test/1.1")
                 .setSocketConfig(socketConfig)
                 .setSslContext(sslcontext)
-                .setExceptionLogger(new StdErrorExceptionLogger())
+                .setExceptionListener(new StdErrorExceptionListener())
                 .registerHandler("*", new HttpFileHandler(docRoot))
                 .create();
 
@@ -114,10 +114,10 @@ public class HttpFileServer {
         });
     }
 
-    static class StdErrorExceptionLogger implements ExceptionLogger {
+    static class StdErrorExceptionListener implements ExceptionListener {
 
         @Override
-        public void log(final Exception ex) {
+        public void onError(final Exception ex) {
             if (ex instanceof SocketTimeoutException) {
                 System.err.println("Connection timed out");
             } else if (ex instanceof ConnectionClosedException) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/NHttpFileServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/NHttpFileServer.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/NHttpFileServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/examples/org/apache/hc/core5/http/examples/NHttpFileServer.java Mon Oct  3 19:28:20 2016
@@ -35,11 +35,11 @@ import java.util.concurrent.TimeUnit;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.hc.core5.http.ExceptionLogger;
-import org.apache.hc.core5.http.HttpConnection;
-import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.ExceptionListener;
+import org.apache.hc.core5.http.HttpConnection;
+import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.MethodNotSupportedException;
 import org.apache.hc.core5.http.bootstrap.nio.HttpServer;
@@ -98,7 +98,7 @@ public class NHttpFileServer {
                 .setServerInfo("Test/1.1")
                 .setIOReactorConfig(config)
                 .setSslContext(sslcontext)
-                .setExceptionLogger(ExceptionLogger.STD_ERR)
+                .setExceptionListener(ExceptionListener.STD_ERR)
                 .registerHandler("*", new HttpFileHandler(docRoot))
                 .create();
 

Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionListener.java (from r1762693, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionLogger.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionListener.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionListener.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionLogger.java&r1=1762693&r2=1763199&rev=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionLogger.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionListener.java Mon Oct  3 19:28:20 2016
@@ -29,25 +29,25 @@ package org.apache.hc.core5.http;
 /**
  * @since 4.4
  */
-public interface ExceptionLogger {
+public interface ExceptionListener {
 
-    public static final ExceptionLogger NO_OP = new ExceptionLogger() {
+    ExceptionListener NO_OP = new ExceptionListener() {
 
         @Override
-        public void log(final Exception ex) {
+        public void onError(final Exception ex) {
         }
 
     };
 
-    public static final ExceptionLogger STD_ERR = new ExceptionLogger() {
+    ExceptionListener STD_ERR = new ExceptionListener() {
 
         @Override
-        public void log(final Exception ex) {
+        public void onError(final Exception ex) {
             ex.printStackTrace();
         }
 
     };
 
-    void log(Exception ex);
+    void onError(Exception ex);
 
 }

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ExceptionListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/HttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/HttpServer.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/HttpServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/HttpServer.java Mon Oct  3 19:28:20 2016
@@ -38,7 +38,7 @@ import java.util.concurrent.atomic.Atomi
 import javax.net.ServerSocketFactory;
 import javax.net.ssl.SSLServerSocket;
 
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.config.SocketConfig;
 import org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnection;
 import org.apache.hc.core5.http.impl.io.HttpService;
@@ -59,7 +59,7 @@ public class HttpServer {
     private final HttpService httpService;
     private final HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory;
     private final SSLServerSetupHandler sslSetupHandler;
-    private final ExceptionLogger exceptionLogger;
+    private final ExceptionListener exceptionListener;
     private final ThreadPoolExecutor listenerExecutorService;
     private final ThreadGroup workerThreads;
     private final WorkerPoolExecutor workerExecutorService;
@@ -76,7 +76,7 @@ public class HttpServer {
             final HttpService httpService,
             final HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory,
             final SSLServerSetupHandler sslSetupHandler,
-            final ExceptionLogger exceptionLogger) {
+            final ExceptionListener exceptionListener) {
         this.port = port;
         this.ifAddress = ifAddress;
         this.socketConfig = socketConfig;
@@ -84,7 +84,7 @@ public class HttpServer {
         this.httpService = httpService;
         this.connectionFactory = connectionFactory;
         this.sslSetupHandler = sslSetupHandler;
-        this.exceptionLogger = exceptionLogger;
+        this.exceptionListener = exceptionListener;
         this.listenerExecutorService = new ThreadPoolExecutor(
                 1, 1, 0L, TimeUnit.MILLISECONDS,
                 new SynchronousQueue<Runnable>(),
@@ -129,7 +129,7 @@ public class HttpServer {
                     this.serverSocket,
                     this.httpService,
                     this.connectionFactory,
-                    this.exceptionLogger,
+                    this.exceptionListener,
                     this.workerExecutorService);
             this.listenerExecutorService.execute(this.requestListener);
         }
@@ -144,7 +144,7 @@ public class HttpServer {
                 try {
                     local.terminate();
                 } catch (final IOException ex) {
-                    this.exceptionLogger.log(ex);
+                    this.exceptionListener.onError(ex);
                 }
             }
             this.workerThreads.interrupt();
@@ -170,7 +170,7 @@ public class HttpServer {
             try {
                 conn.shutdown();
             } catch (IOException ex) {
-                this.exceptionLogger.log(ex);
+                this.exceptionListener.onError(ex);
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/RequestListener.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/RequestListener.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/RequestListener.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/RequestListener.java Mon Oct  3 19:28:20 2016
@@ -32,7 +32,7 @@ import java.net.Socket;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.config.SocketConfig;
 import org.apache.hc.core5.http.impl.io.HttpService;
 import org.apache.hc.core5.http.io.HttpConnectionFactory;
@@ -47,7 +47,7 @@ class RequestListener implements Runnabl
     private final ServerSocket serversocket;
     private final HttpService httpService;
     private final HttpConnectionFactory<? extends HttpServerConnection> connectionFactory;
-    private final ExceptionLogger exceptionLogger;
+    private final ExceptionListener exceptionListener;
     private final ExecutorService executorService;
     private final AtomicBoolean terminated;
 
@@ -56,13 +56,13 @@ class RequestListener implements Runnabl
             final ServerSocket serversocket,
             final HttpService httpService,
             final HttpConnectionFactory<? extends HttpServerConnection> connectionFactory,
-            final ExceptionLogger exceptionLogger,
+            final ExceptionListener exceptionListener,
             final ExecutorService executorService) {
         this.socketConfig = socketConfig;
         this.serversocket = serversocket;
         this.connectionFactory = connectionFactory;
         this.httpService = httpService;
-        this.exceptionLogger = exceptionLogger;
+        this.exceptionListener = exceptionListener;
         this.executorService = executorService;
         this.terminated = new AtomicBoolean(false);
     }
@@ -85,11 +85,11 @@ class RequestListener implements Runnabl
                     socket.setSoLinger(true, this.socketConfig.getSoLinger());
                 }
                 final HttpServerConnection conn = this.connectionFactory.createConnection(socket);
-                final Worker worker = new Worker(this.httpService, conn, this.exceptionLogger);
+                final Worker worker = new Worker(this.httpService, conn, this.exceptionListener);
                 this.executorService.execute(worker);
             }
         } catch (final Exception ex) {
-            this.exceptionLogger.log(ex);
+            this.exceptionListener.onError(ex);
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/ServerBootstrap.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/ServerBootstrap.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/ServerBootstrap.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/ServerBootstrap.java Mon Oct  3 19:28:20 2016
@@ -35,7 +35,7 @@ import javax.net.ServerSocketFactory;
 import javax.net.ssl.SSLContext;
 
 import org.apache.hc.core5.http.ConnectionReuseStrategy;
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.HttpRequestInterceptor;
 import org.apache.hc.core5.http.HttpResponseFactory;
 import org.apache.hc.core5.http.HttpResponseInterceptor;
@@ -83,7 +83,7 @@ public class ServerBootstrap {
     private SSLContext sslContext;
     private SSLServerSetupHandler sslSetupHandler;
     private HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory;
-    private ExceptionLogger exceptionLogger;
+    private ExceptionListener exceptionListener;
 
     private ServerBootstrap() {
     }
@@ -304,10 +304,10 @@ public class ServerBootstrap {
     }
 
     /**
-     * Assigns {@link org.apache.hc.core5.http.ExceptionLogger} instance.
+     * Assigns {@link ExceptionListener} instance.
      */
-    public final ServerBootstrap setExceptionLogger(final ExceptionLogger exceptionLogger) {
-        this.exceptionLogger = exceptionLogger;
+    public final ServerBootstrap setExceptionListener(final ExceptionListener exceptionListener) {
+        this.exceptionListener = exceptionListener;
         return this;
     }
 
@@ -396,9 +396,9 @@ public class ServerBootstrap {
             }
         }
 
-        ExceptionLogger exceptionLoggerCopy = this.exceptionLogger;
-        if (exceptionLoggerCopy == null) {
-            exceptionLoggerCopy = ExceptionLogger.NO_OP;
+        ExceptionListener exceptionListenerCopy = this.exceptionListener;
+        if (exceptionListenerCopy == null) {
+            exceptionListenerCopy = ExceptionListener.NO_OP;
         }
 
         return new HttpServer(
@@ -409,7 +409,7 @@ public class ServerBootstrap {
                 httpService,
                 connectionFactoryCopy,
                 this.sslSetupHandler,
-                exceptionLoggerCopy);
+                exceptionListenerCopy);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/Worker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/Worker.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/Worker.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/io/Worker.java Mon Oct  3 19:28:20 2016
@@ -28,7 +28,7 @@ package org.apache.hc.core5.http.bootstr
 
 import java.io.IOException;
 
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.impl.io.HttpService;
 import org.apache.hc.core5.http.io.HttpServerConnection;
 import org.apache.hc.core5.http.protocol.BasicHttpContext;
@@ -41,16 +41,16 @@ class Worker implements Runnable {
 
     private final HttpService httpservice;
     private final HttpServerConnection conn;
-    private final ExceptionLogger exceptionLogger;
+    private final ExceptionListener exceptionListener;
 
     Worker(
             final HttpService httpservice,
             final HttpServerConnection conn,
-            final ExceptionLogger exceptionLogger) {
+            final ExceptionListener exceptionListener) {
         super();
         this.httpservice = httpservice;
         this.conn = conn;
-        this.exceptionLogger = exceptionLogger;
+        this.exceptionListener = exceptionListener;
     }
 
     public HttpServerConnection getConnection() {
@@ -68,12 +68,12 @@ class Worker implements Runnable {
             }
             this.conn.close();
         } catch (final Exception ex) {
-            this.exceptionLogger.log(ex);
+            this.exceptionListener.onError(ex);
         } finally {
             try {
                 this.conn.shutdown();
             } catch (final IOException ex) {
-                this.exceptionLogger.log(ex);
+                this.exceptionListener.onError(ex);
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/HttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/HttpServer.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/HttpServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/HttpServer.java Mon Oct  3 19:28:20 2016
@@ -34,7 +34,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.impl.nio.DefaultHttpServerIOEventHandlerFactory;
 import org.apache.hc.core5.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.hc.core5.http.nio.NHttpConnectionFactory;
@@ -56,7 +56,7 @@ public class HttpServer {
     private final InetAddress ifAddress;
     private final IOReactorConfig ioReactorConfig;
     private final NHttpServerEventHandler serverEventHandler;
-    private final ExceptionLogger exceptionLogger;
+    private final ExceptionListener exceptionListener;
     private final ExecutorService listenerExecutorService;
     private final ThreadGroup dispatchThreads;
     private final AtomicReference<Status> status;
@@ -70,12 +70,12 @@ public class HttpServer {
             final IOReactorConfig ioReactorConfig,
             final NHttpServerEventHandler serverEventHandler,
             final NHttpConnectionFactory<? extends DefaultNHttpServerConnection> connectionFactory,
-            final ExceptionLogger exceptionLogger) {
+            final ExceptionListener exceptionListener) {
         this.port = port;
         this.ifAddress = ifAddress;
         this.ioReactorConfig = ioReactorConfig;
         this.serverEventHandler = serverEventHandler;
-        this.exceptionLogger = exceptionLogger;
+        this.exceptionListener = exceptionListener;
         this.listenerExecutorService = Executors.newSingleThreadExecutor(
                 new ThreadFactoryImpl("HTTP-listener-" + this.port));
         this.dispatchThreads = new ThreadGroup("I/O-dispatchers");
@@ -90,13 +90,13 @@ public class HttpServer {
         this.ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
             @Override
             public boolean handle(final IOException ex) {
-                exceptionLogger.log(ex);
+                exceptionListener.onError(ex);
                 return false;
             }
 
             @Override
             public boolean handle(final RuntimeException ex) {
-                exceptionLogger.log(ex);
+                exceptionListener.onError(ex);
                 return false;
             }
         });
@@ -117,7 +117,7 @@ public class HttpServer {
                     try {
                         ioReactor.execute();
                     } catch (final Exception ex) {
-                        exceptionLogger.log(ex);
+                        exceptionListener.onError(ex);
                     }
                 }
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/ServerBootstrap.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/ServerBootstrap.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/ServerBootstrap.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/bootstrap/nio/ServerBootstrap.java Mon Oct  3 19:28:20 2016
@@ -34,7 +34,7 @@ import java.util.Map;
 import javax.net.ssl.SSLContext;
 
 import org.apache.hc.core5.http.ConnectionReuseStrategy;
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.HttpRequestInterceptor;
 import org.apache.hc.core5.http.HttpResponseFactory;
 import org.apache.hc.core5.http.HttpResponseInterceptor;
@@ -83,7 +83,7 @@ public class ServerBootstrap {
     private SSLContext sslContext;
     private SSLSetupHandler sslSetupHandler;
     private NHttpConnectionFactory<? extends DefaultNHttpServerConnection> connectionFactory;
-    private ExceptionLogger exceptionLogger;
+    private ExceptionListener exceptionListener;
 
     private ServerBootstrap() {
     }
@@ -299,10 +299,10 @@ public class ServerBootstrap {
     }
 
     /**
-     * Assigns {@link org.apache.hc.core5.http.ExceptionLogger} instance.
+     * Assigns {@link ExceptionListener} instance.
      */
-    public final ServerBootstrap setExceptionLogger(final ExceptionLogger exceptionLogger) {
-        this.exceptionLogger = exceptionLogger;
+    public final ServerBootstrap setExceptionListener(final ExceptionListener exceptionListener) {
+        this.exceptionListener = exceptionListener;
         return this;
     }
 
@@ -379,17 +379,17 @@ public class ServerBootstrap {
             }
         }
 
-        ExceptionLogger exceptionLoggerCopy = this.exceptionLogger;
-        if (exceptionLoggerCopy == null) {
-            exceptionLoggerCopy = ExceptionLogger.NO_OP;
+        ExceptionListener exceptionListenerCopy = this.exceptionListener;
+        if (exceptionListenerCopy == null) {
+            exceptionListenerCopy = ExceptionListener.NO_OP;
         }
 
         final HttpAsyncService httpService = new HttpAsyncService(
                 httpProcessorCopy, connStrategyCopy, responseFactoryCopy, handlerMapperCopy,
-                this.expectationVerifier, exceptionLoggerCopy);
+                this.expectationVerifier, exceptionListenerCopy);
 
         return new HttpServer(this.listenerPort, this.localAddress, this.ioReactorConfig,
-                httpService, connectionFactoryCopy, exceptionLoggerCopy);
+                httpService, connectionFactoryCopy, exceptionListenerCopy);
 
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java Mon Oct  3 19:28:20 2016
@@ -38,7 +38,7 @@ import org.apache.hc.core5.http.ClassicH
 import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.ConnectionClosedException;
 import org.apache.hc.core5.http.ConnectionReuseStrategy;
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HeaderElements;
 import org.apache.hc.core5.http.HttpEntity;
@@ -94,15 +94,15 @@ public class HttpAsyncRequestExecutor im
 
     private final int waitForContinue;
     private final ConnectionReuseStrategy connReuseStrategy;
-    private final ExceptionLogger exceptionLogger;
+    private final ExceptionListener exceptionListener;
 
     /**
      * Creates new instance of {@code HttpAsyncRequestExecutor}.
      * @param waitForContinue wait for continue time period.
      * @param connReuseStrategy Connection re-use strategy. If {@code null}
      *   {@link DefaultConnectionReuseStrategy#INSTANCE} will be used.
-     * @param exceptionLogger Exception logger. If {@code null}
-     *   {@link ExceptionLogger#NO_OP} will be used. Please note that the exception
+     * @param exceptionListener Exception logger. If {@code null}
+     *   {@link ExceptionListener#NO_OP} will be used. Please note that the exception
      *   logger will be only used to log I/O exception thrown while closing
      *   {@link java.io.Closeable} objects (such as {@link org.apache.hc.core5.http.HttpConnection}).
      *
@@ -111,12 +111,12 @@ public class HttpAsyncRequestExecutor im
     public HttpAsyncRequestExecutor(
             final int waitForContinue,
             final ConnectionReuseStrategy connReuseStrategy,
-            final ExceptionLogger exceptionLogger) {
+            final ExceptionListener exceptionListener) {
         super();
         this.waitForContinue = Args.positive(waitForContinue, "Wait for continue time");
         this.connReuseStrategy = connReuseStrategy != null ? connReuseStrategy :
                 DefaultConnectionReuseStrategy.INSTANCE;
-        this.exceptionLogger = exceptionLogger != null ? exceptionLogger : ExceptionLogger.NO_OP;
+        this.exceptionListener = exceptionListener != null ? exceptionListener : ExceptionListener.NO_OP;
     }
 
     /**
@@ -448,7 +448,7 @@ public class HttpAsyncRequestExecutor im
      * @param ex I/O exception thrown by {@link java.io.Closeable#close()}
      */
     protected void log(final Exception ex) {
-        this.exceptionLogger.log(ex);
+        this.exceptionListener.onError(ex);
     }
 
     private static State getState(final NHttpConnection conn) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequester.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequester.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequester.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequester.java Mon Oct  3 19:28:20 2016
@@ -36,7 +36,7 @@ import org.apache.hc.core5.annotation.Th
 import org.apache.hc.core5.concurrent.BasicFuture;
 import org.apache.hc.core5.concurrent.FutureCallback;
 import org.apache.hc.core5.http.ConnectionClosedException;
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.nio.HttpAsyncClientExchangeHandler;
 import org.apache.hc.core5.http.nio.HttpAsyncRequestProducer;
@@ -62,13 +62,13 @@ import org.apache.hc.core5.util.Args;
 public class HttpAsyncRequester {
 
     private final HttpProcessor httpprocessor;
-    private final ExceptionLogger exceptionLogger;
+    private final ExceptionListener exceptionListener;
 
     /**
      * Creates new instance of {@code HttpAsyncRequester}.
      * @param httpprocessor HTTP protocol processor.
-     * @param exceptionLogger Exception logger. If {@code null}
-     *   {@link ExceptionLogger#NO_OP} will be used. Please note that the exception
+     * @param exceptionListener Exception logger. If {@code null}
+     *   {@link ExceptionListener#NO_OP} will be used. Please note that the exception
      *   logger will be only used to log I/O exception thrown while closing
      *   {@link java.io.Closeable} objects (such as {@link org.apache.hc.core5.http.HttpConnection}).
      *
@@ -76,10 +76,10 @@ public class HttpAsyncRequester {
      */
     public HttpAsyncRequester(
             final HttpProcessor httpprocessor,
-            final ExceptionLogger exceptionLogger) {
+            final ExceptionListener exceptionListener) {
         super();
         this.httpprocessor = Args.notNull(httpprocessor, "HTTP processor");
-        this.exceptionLogger = exceptionLogger != null ? exceptionLogger : ExceptionLogger.NO_OP;
+        this.exceptionListener = exceptionListener != null ? exceptionListener : ExceptionListener.NO_OP;
     }
 
     /**
@@ -549,7 +549,7 @@ public class HttpAsyncRequester {
      * @param ex I/O exception thrown by {@link java.io.Closeable#close()}
      */
     protected void log(final Exception ex) {
-        this.exceptionLogger.log(ex);
+        this.exceptionListener.onError(ex);
     }
 
     private void close(final Closeable closeable) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java?rev=1763199&r1=1763198&r2=1763199&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java Mon Oct  3 19:28:20 2016
@@ -40,7 +40,7 @@ import org.apache.hc.core5.concurrent.Ca
 import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.ConnectionReuseStrategy;
-import org.apache.hc.core5.http.ExceptionLogger;
+import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
@@ -115,7 +115,7 @@ public class HttpAsyncService implements
     private final HttpResponseFactory<ClassicHttpResponse> responseFactory;
     private final HttpAsyncRequestHandlerMapper handlerMapper;
     private final HttpAsyncExpectationVerifier expectationVerifier;
-    private final ExceptionLogger exceptionLogger;
+    private final ExceptionListener exceptionListener;
 
     /**
      * Creates new instance of {@code HttpAsyncServerProtocolHandler}.
@@ -149,8 +149,8 @@ public class HttpAsyncService implements
      *   {@link DefaultHttpResponseFactory#INSTANCE} will be used.
      * @param handlerMapper Request handler mapper.
      * @param expectationVerifier Request expectation verifier. May be {@code null}.
-     * @param exceptionLogger Exception logger. If {@code null}
-     *   {@link ExceptionLogger#NO_OP} will be used. Please note that the exception
+     * @param exceptionListener Exception logger. If {@code null}
+     *   {@link ExceptionListener#NO_OP} will be used. Please note that the exception
      *   logger will be only used to log I/O exception thrown while closing
      *   {@link java.io.Closeable} objects (such as {@link org.apache.hc.core5.http.HttpConnection}).
      *
@@ -162,7 +162,7 @@ public class HttpAsyncService implements
             final HttpResponseFactory<ClassicHttpResponse> responseFactory,
             final HttpAsyncRequestHandlerMapper handlerMapper,
             final HttpAsyncExpectationVerifier expectationVerifier,
-            final ExceptionLogger exceptionLogger) {
+            final ExceptionListener exceptionListener) {
         super();
         this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
         this.connStrategy = connStrategy != null ? connStrategy :
@@ -171,7 +171,7 @@ public class HttpAsyncService implements
                 DefaultHttpResponseFactory.INSTANCE;
         this.handlerMapper = handlerMapper;
         this.expectationVerifier = expectationVerifier;
-        this.exceptionLogger = exceptionLogger != null ? exceptionLogger : ExceptionLogger.NO_OP;
+        this.exceptionListener = exceptionListener != null ? exceptionListener : ExceptionListener.NO_OP;
     }
 
     /**
@@ -193,8 +193,8 @@ public class HttpAsyncService implements
      *
      * @param httpProcessor HTTP protocol processor.
      * @param handlerMapper Request handler mapper.
-     * @param exceptionLogger Exception logger. If {@code null}
-     *   {@link ExceptionLogger#NO_OP} will be used. Please note that the exception
+     * @param exceptionListener Exception logger. If {@code null}
+     *   {@link ExceptionListener#NO_OP} will be used. Please note that the exception
      *   logger will be only used to log I/O exception thrown while closing
      *   {@link java.io.Closeable} objects (such as {@link org.apache.hc.core5.http.HttpConnection}).
      *
@@ -203,8 +203,8 @@ public class HttpAsyncService implements
     public HttpAsyncService(
             final HttpProcessor httpProcessor,
             final HttpAsyncRequestHandlerMapper handlerMapper,
-            final ExceptionLogger exceptionLogger) {
-        this(httpProcessor, null, null, handlerMapper, null, exceptionLogger);
+            final ExceptionListener exceptionListener) {
+        this(httpProcessor, null, null, handlerMapper, null, exceptionListener);
     }
 
     @Override
@@ -493,7 +493,7 @@ public class HttpAsyncService implements
      * @param ex I/O exception thrown by {@link java.io.Closeable#close()}
      */
     protected void log(final Exception ex) {
-        this.exceptionLogger.log(ex);
+        this.exceptionListener.onError(ex);
     }
 
     private void shutdownConnection(final NHttpConnection conn) {




Mime
View raw message