HttpAsyncClientBuilder: Make IOReactor exception callback configurable
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
index 212bc57..612f35d 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
@@ -209,6 +209,7 @@
private AsyncClientConnectionManager connManager;
private boolean connManagerShared;
private IOReactorConfig ioReactorConfig;
+ private Callback<Exception> ioReactorExceptionCallback;
private Http1Config h1Config;
private H2Config h2Config;
private CharCodingConfig charCodingConfig;
@@ -317,6 +318,16 @@
}
/**
+ * Sets the callback that will be invoked when the client's IOReactor encounters an uncaught exception.
+ *
+ * @since 5.1
+ */
+ public final HttpAsyncClientBuilder setIoReactorExceptionCallback(final Callback<Exception> ioReactorExceptionCallback) {
+ this.ioReactorExceptionCallback = ioReactorExceptionCallback;
+ return this;
+ }
+
+ /**
* Sets {@link CharCodingConfig} configuration.
*/
public final HttpAsyncClientBuilder setCharCodingConfig(final CharCodingConfig charCodingConfig) {
@@ -932,7 +943,7 @@
ioReactorConfig != null ? ioReactorConfig : IOReactorConfig.DEFAULT,
threadFactory != null ? threadFactory : new DefaultThreadFactory("httpclient-dispatch", true),
LoggingIOSessionDecorator.INSTANCE,
- LoggingExceptionCallback.INSTANCE,
+ ioReactorExceptionCallback != null ? ioReactorExceptionCallback : LoggingExceptionCallback.INSTANCE,
null,
new Callback<IOSession>() {