You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2011/08/12 13:30:47 UTC
svn commit: r1157057 - in /httpcomponents/httpcore/branches/4.1.x: ./
httpcore-ab/src/main/java/org/apache/http/benchmark/
httpcore-nio/src/main/java/org/apache/http/impl/nio/
httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/
Author: olegk
Date: Fri Aug 12 11:30:47 2011
New Revision: 1157057
URL: http://svn.apache.org/viewvc?rev=1157057&view=rev
Log:
I/O event dispatchers to shut down the I/O session in case of a runtime exception (merged from trunk)
Modified:
httpcomponents/httpcore/branches/4.1.x/ (props changed)
httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java (props changed)
httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/CommandLineUtils.java (props changed)
httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/Config.java (props changed)
httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/DefaultHeader.java (props changed)
httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java (props changed)
httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/ResultProcessor.java (props changed)
httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/Stats.java (props changed)
httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java
httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java
httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
Propchange: httpcomponents/httpcore/branches/4.1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 11:30:47 2011
@@ -1,2 +1,2 @@
/httpcomponents/httpcore/branches/ibm_compat_branch:755687-758898
-/httpcomponents/httpcore/trunk:1102241-1102657,1133031-1134569,1134571,1139799-1140255,1149742-1150202
+/httpcomponents/httpcore/trunk:1102241-1102657,1133031-1134569,1134571,1139799-1140255,1149742-1150202,1157055
Propchange: httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 11:30:47 2011
@@ -1 +1,2 @@
/httpcomponents/httpcore/branches/ibm_compat_branch/httpcore-ab/src/main/java/org/apache/http/contrib/benchmark/BenchmarkWorker.java:755687-758898
+/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java:1157055
Propchange: httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/CommandLineUtils.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 11:30:47 2011
@@ -1 +1,2 @@
/httpcomponents/httpcore/branches/ibm_compat_branch/httpcore-ab/src/main/java/org/apache/http/contrib/benchmark/CommandLineUtils.java:755687-758898
+/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/CommandLineUtils.java:1157055
Propchange: httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/Config.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 11:30:47 2011
@@ -1 +1,2 @@
/httpcomponents/httpcore/branches/ibm_compat_branch/httpcore-ab/src/main/java/org/apache/http/contrib/benchmark/Config.java:755687-758898
+/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/Config.java:1157055
Propchange: httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/DefaultHeader.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 11:30:47 2011
@@ -1 +1,2 @@
/httpcomponents/httpcore/branches/ibm_compat_branch/httpcore-ab/src/main/java/org/apache/http/contrib/benchmark/DefaultHeader.java:755687-758898
+/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/DefaultHeader.java:1157055
Propchange: httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 11:30:47 2011
@@ -1 +1,2 @@
/httpcomponents/httpcore/branches/ibm_compat_branch/httpcore-ab/src/main/java/org/apache/http/contrib/benchmark/HttpBenchmark.java:755687-758898
+/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java:1157055
Propchange: httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/ResultProcessor.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 11:30:47 2011
@@ -1 +1,2 @@
/httpcomponents/httpcore/branches/ibm_compat_branch/httpcore-ab/src/main/java/org/apache/http/contrib/benchmark/ResultProcessor.java:755687-758898
+/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/ResultProcessor.java:1157055
Propchange: httpcomponents/httpcore/branches/4.1.x/httpcore-ab/src/main/java/org/apache/http/benchmark/Stats.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 11:30:47 2011
@@ -1 +1,2 @@
/httpcomponents/httpcore/branches/ibm_compat_branch/httpcore-ab/src/main/java/org/apache/http/contrib/benchmark/Stats.java:755687-758898
+/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/Stats.java:1157055
Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java?rev=1157057&r1=1157056&r2=1157057&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java (original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java Fri Aug 12 11:30:47 2011
@@ -120,23 +120,33 @@ public class DefaultClientIOEventDispatc
* @return newly created HTTP connection.
*/
protected NHttpClientIOTarget createConnection(final IOSession session) {
- return new DefaultNHttpClientConnection(
- session,
- createHttpResponseFactory(),
- this.allocator,
- this.params);
+ try {
+ return new DefaultNHttpClientConnection(
+ session,
+ createHttpResponseFactory(),
+ this.allocator,
+ this.params);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void connected(final IOSession session) {
- NHttpClientIOTarget conn = createConnection(session);
- Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY);
- session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
- this.handler.connected(conn, attachment);
+ try {
+ NHttpClientIOTarget conn = createConnection(session);
+ Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY);
+ session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+ this.handler.connected(conn, attachment);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void disconnected(final IOSession session) {
- NHttpClientIOTarget conn =
- (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
+ NHttpClientIOTarget conn = (NHttpClientIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
if (conn != null) {
this.handler.closed(conn);
}
@@ -149,24 +159,39 @@ public class DefaultClientIOEventDispatc
}
public void inputReady(final IOSession session) {
- NHttpClientIOTarget conn =
- (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- conn.consumeInput(this.handler);
+ try {
+ NHttpClientIOTarget conn = (NHttpClientIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ conn.consumeInput(this.handler);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void outputReady(final IOSession session) {
- NHttpClientIOTarget conn =
- (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- conn.produceOutput(this.handler);
+ try {
+ NHttpClientIOTarget conn = (NHttpClientIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ conn.produceOutput(this.handler);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void timeout(final IOSession session) {
- NHttpClientIOTarget conn =
- (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- this.handler.timeout(conn);
+ try {
+ NHttpClientIOTarget conn = (NHttpClientIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ this.handler.timeout(conn);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
}
Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java?rev=1157057&r1=1157056&r2=1157057&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java (original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java Fri Aug 12 11:30:47 2011
@@ -128,14 +128,19 @@ public class DefaultServerIOEventDispatc
}
public void connected(final IOSession session) {
- NHttpServerIOTarget conn = createConnection(session);
- session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
- this.handler.connected(conn);
+ try {
+ NHttpServerIOTarget conn = createConnection(session);
+ session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+ this.handler.connected(conn);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void disconnected(final IOSession session) {
- NHttpServerIOTarget conn =
- (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
+ NHttpServerIOTarget conn = (NHttpServerIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
if (conn != null) {
this.handler.closed(conn);
}
@@ -148,24 +153,39 @@ public class DefaultServerIOEventDispatc
}
public void inputReady(final IOSession session) {
- NHttpServerIOTarget conn =
- (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- conn.consumeInput(this.handler);
+ try {
+ NHttpServerIOTarget conn = (NHttpServerIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ conn.consumeInput(this.handler);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void outputReady(final IOSession session) {
- NHttpServerIOTarget conn =
- (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- conn.produceOutput(this.handler);
+ try {
+ NHttpServerIOTarget conn = (NHttpServerIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ conn.produceOutput(this.handler);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void timeout(final IOSession session) {
- NHttpServerIOTarget conn =
- (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- this.handler.timeout(conn);
+ try {
+ NHttpServerIOTarget conn = (NHttpServerIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ this.handler.timeout(conn);
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
}
Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java?rev=1157057&r1=1157056&r2=1157057&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java (original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java Fri Aug 12 11:30:47 2011
@@ -186,32 +186,36 @@ public class SSLClientIOEventDispatch im
}
public void connected(final IOSession session) {
-
- SSLIOSession sslSession = createSSLIOSession(
- session,
- this.sslcontext,
- this.sslHandler);
-
- NHttpClientIOTarget conn = createConnection(
- sslSession);
-
- session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
- session.setAttribute(SSL_SESSION, sslSession);
-
- Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY);
- this.handler.connected(conn, attachment);
-
- try {
- sslSession.bind(SSLMode.CLIENT, this.params);
- } catch (SSLException ex) {
- this.handler.exception(conn, ex);
- sslSession.shutdown();
- }
+ try {
+ SSLIOSession sslSession = createSSLIOSession(
+ session,
+ this.sslcontext,
+ this.sslHandler);
+
+ NHttpClientIOTarget conn = createConnection(
+ sslSession);
+
+ session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+ session.setAttribute(SSL_SESSION, sslSession);
+
+ Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY);
+ this.handler.connected(conn, attachment);
+
+ try {
+ sslSession.bind(SSLMode.CLIENT, this.params);
+ } catch (SSLException ex) {
+ this.handler.exception(conn, ex);
+ sslSession.shutdown();
+ }
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void disconnected(final IOSession session) {
- NHttpClientIOTarget conn =
- (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
+ NHttpClientIOTarget conn = (NHttpClientIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
if (conn != null) {
this.handler.closed(conn);
}
@@ -230,58 +234,73 @@ public class SSLClientIOEventDispatch im
}
public void inputReady(final IOSession session) {
- NHttpClientIOTarget conn =
- (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- SSLIOSession sslSession =
- (SSLIOSession) session.getAttribute(SSL_SESSION);
- ensureNotNull(sslSession);
-
- try {
- if (sslSession.isAppInputReady()) {
- conn.consumeInput(this.handler);
+ try {
+ NHttpClientIOTarget conn = (NHttpClientIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ SSLIOSession sslSession =
+ (SSLIOSession) session.getAttribute(SSL_SESSION);
+ ensureNotNull(sslSession);
+
+ try {
+ if (sslSession.isAppInputReady()) {
+ conn.consumeInput(this.handler);
+ }
+ sslSession.inboundTransport();
+ } catch (IOException ex) {
+ this.handler.exception(conn, ex);
+ sslSession.shutdown();
}
- sslSession.inboundTransport();
- } catch (IOException ex) {
- this.handler.exception(conn, ex);
- sslSession.shutdown();
- }
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void outputReady(final IOSession session) {
- NHttpClientIOTarget conn =
- (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- SSLIOSession sslSession =
- (SSLIOSession) session.getAttribute(SSL_SESSION);
- ensureNotNull(sslSession);
-
- try {
- if (sslSession.isAppOutputReady()) {
- conn.produceOutput(this.handler);
+ try {
+ NHttpClientIOTarget conn = (NHttpClientIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ SSLIOSession sslSession =
+ (SSLIOSession) session.getAttribute(SSL_SESSION);
+ ensureNotNull(sslSession);
+
+ try {
+ if (sslSession.isAppOutputReady()) {
+ conn.produceOutput(this.handler);
+ }
+ sslSession.outboundTransport();
+ } catch (IOException ex) {
+ this.handler.exception(conn, ex);
+ sslSession.shutdown();
}
- sslSession.outboundTransport();
- } catch (IOException ex) {
- this.handler.exception(conn, ex);
- sslSession.shutdown();
- }
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void timeout(final IOSession session) {
- NHttpClientIOTarget conn =
- (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- SSLIOSession sslSession =
- (SSLIOSession) session.getAttribute(SSL_SESSION);
- ensureNotNull(sslSession);
-
- this.handler.timeout(conn);
- synchronized (sslSession) {
- if (sslSession.isOutboundDone() && !sslSession.isInboundDone()) {
- // The session failed to terminate cleanly
- sslSession.shutdown();
- }
- }
+ try {
+ NHttpClientIOTarget conn = (NHttpClientIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ SSLIOSession sslSession =
+ (SSLIOSession) session.getAttribute(SSL_SESSION);
+ ensureNotNull(sslSession);
+
+ this.handler.timeout(conn);
+ synchronized (sslSession) {
+ if (sslSession.isOutboundDone() && !sslSession.isInboundDone()) {
+ // The session failed to terminate cleanly
+ sslSession.shutdown();
+ }
+ }
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
}
Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java?rev=1157057&r1=1157056&r2=1157057&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java (original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java Fri Aug 12 11:30:47 2011
@@ -186,32 +186,35 @@ public class SSLServerIOEventDispatch im
}
public void connected(final IOSession session) {
-
- SSLIOSession sslSession = createSSLIOSession(
- session,
- this.sslcontext,
- this.sslHandler);
-
- NHttpServerIOTarget conn = createConnection(
- sslSession);
-
- session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
- session.setAttribute(SSL_SESSION, sslSession);
-
- this.handler.connected(conn);
-
- try {
- sslSession.bind(SSLMode.SERVER, this.params);
- } catch (SSLException ex) {
- this.handler.exception(conn, ex);
- sslSession.shutdown();
- }
+ try {
+ SSLIOSession sslSession = createSSLIOSession(
+ session,
+ this.sslcontext,
+ this.sslHandler);
+
+ NHttpServerIOTarget conn = createConnection(
+ sslSession);
+
+ session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+ session.setAttribute(SSL_SESSION, sslSession);
+
+ this.handler.connected(conn);
+
+ try {
+ sslSession.bind(SSLMode.SERVER, this.params);
+ } catch (SSLException ex) {
+ this.handler.exception(conn, ex);
+ sslSession.shutdown();
+ }
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void disconnected(final IOSession session) {
- NHttpServerIOTarget conn =
- (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
-
+ NHttpServerIOTarget conn = (NHttpServerIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
if (conn != null) {
this.handler.closed(conn);
}
@@ -230,58 +233,73 @@ public class SSLServerIOEventDispatch im
}
public void inputReady(final IOSession session) {
- NHttpServerIOTarget conn =
- (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- SSLIOSession sslSession =
- (SSLIOSession) session.getAttribute(SSL_SESSION);
- ensureNotNull(sslSession);
-
- try {
- if (sslSession.isAppInputReady()) {
- conn.consumeInput(this.handler);
+ try {
+ NHttpServerIOTarget conn = (NHttpServerIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ SSLIOSession sslSession =
+ (SSLIOSession) session.getAttribute(SSL_SESSION);
+ ensureNotNull(sslSession);
+
+ try {
+ if (sslSession.isAppInputReady()) {
+ conn.consumeInput(this.handler);
+ }
+ sslSession.inboundTransport();
+ } catch (IOException ex) {
+ this.handler.exception(conn, ex);
+ sslSession.shutdown();
}
- sslSession.inboundTransport();
- } catch (IOException ex) {
- this.handler.exception(conn, ex);
- sslSession.shutdown();
- }
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void outputReady(final IOSession session) {
- NHttpServerIOTarget conn =
- (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- SSLIOSession sslSession =
- (SSLIOSession) session.getAttribute(SSL_SESSION);
- ensureNotNull(sslSession);
-
- try {
- if (sslSession.isAppOutputReady()) {
- conn.produceOutput(this.handler);
+ try {
+ NHttpServerIOTarget conn = (NHttpServerIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ SSLIOSession sslSession =
+ (SSLIOSession) session.getAttribute(SSL_SESSION);
+ ensureNotNull(sslSession);
+
+ try {
+ if (sslSession.isAppOutputReady()) {
+ conn.produceOutput(this.handler);
+ }
+ sslSession.outboundTransport();
+ } catch (IOException ex) {
+ this.handler.exception(conn, ex);
+ sslSession.shutdown();
}
- sslSession.outboundTransport();
- } catch (IOException ex) {
- this.handler.exception(conn, ex);
- sslSession.shutdown();
- }
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
public void timeout(final IOSession session) {
- NHttpServerIOTarget conn =
- (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
- ensureNotNull(conn);
- SSLIOSession sslSession =
- (SSLIOSession) session.getAttribute(SSL_SESSION);
- ensureNotNull(sslSession);
-
- this.handler.timeout(conn);
- synchronized (sslSession) {
- if (sslSession.isOutboundDone() && !sslSession.isInboundDone()) {
- // The session failed to cleanly terminate
- sslSession.shutdown();
+ try {
+ NHttpServerIOTarget conn = (NHttpServerIOTarget) session.getAttribute(
+ ExecutionContext.HTTP_CONNECTION);
+ ensureNotNull(conn);
+ SSLIOSession sslSession =
+ (SSLIOSession) session.getAttribute(SSL_SESSION);
+ ensureNotNull(sslSession);
+
+ this.handler.timeout(conn);
+ synchronized (sslSession) {
+ if (sslSession.isOutboundDone() && !sslSession.isInboundDone()) {
+ // The session failed to cleanly terminate
+ sslSession.shutdown();
+ }
}
- }
+ } catch (RuntimeException ex) {
+ session.shutdown();
+ throw ex;
+ }
}
}