Skip to content

Commit

Permalink
HttpAsyncClientBuilder: Make IOReactor exception callback configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
rschmitt committed Mar 31, 2021
1 parent 3f09dbe commit f597588
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ private ExecInterceptorEntry(
private AsyncClientConnectionManager connManager;
private boolean connManagerShared;
private IOReactorConfig ioReactorConfig;
private Callback<Exception> ioReactorExceptionCallback;
private Http1Config h1Config;
private H2Config h2Config;
private CharCodingConfig charCodingConfig;
Expand Down Expand Up @@ -316,6 +317,16 @@ public final HttpAsyncClientBuilder setIOReactorConfig(final IOReactorConfig ioR
return this;
}

/**
* 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.
*/
Expand Down Expand Up @@ -932,7 +943,7 @@ public AsyncPushConsumer create(final HttpRequest request, final HttpContext con
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>() {

Expand Down

0 comments on commit f597588

Please sign in to comment.