Skip to content

Commit f296f27

Browse files
committed
("Worker threads disappearing when using ThrottleRequestFilter and max connections") Collaboration works with Craig Macdonald
1 parent e473edd commit f296f27

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/main/java/com/ning/http/client/providers/netty/NettyAsyncHttpProvider.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,20 @@ private <T> ListenableFuture<T> doConnect(final Request request, final AsyncHand
815815

816816
try {
817817
writeRequest(channel, config, f, nettyRequest);
818-
} catch (IllegalStateException ex) {
818+
} catch (Exception ex) {
819819
log.debug("writeRequest failure", ex);
820820
if (useSSl && ex.getMessage() != null && ex.getMessage().contains("SSLEngine")) {
821821
log.debug("SSLEngine failure", ex);
822822
f = null;
823823
} else {
824-
throw ex;
824+
try {
825+
asyncHandler.onThrowable(ex);
826+
} catch (Throwable t) {
827+
log.warn("doConnect.writeRequest()", t);
828+
}
829+
IOException ioe = new IOException(ex.getMessage());
830+
ioe.initCause(ex);
831+
throw ioe;
825832
}
826833
}
827834
return f;
@@ -910,6 +917,11 @@ private <T> ListenableFuture<T> doConnect(final Request request, final AsyncHand
910917
}
911918
IOException ioe = new IOException(e.getMessage());
912919
ioe.initCause(e);
920+
try {
921+
asyncHandler.onThrowable(ioe);
922+
} catch (Throwable t) {
923+
log.warn("c.operationComplete()", t);
924+
}
913925
throw ioe;
914926
}
915927
} else {

0 commit comments

Comments
 (0)