Remove default blockTimeout on interface clients
See gh-30403
This commit is contained in:
committed by
rstoyanchev
parent
e416dfdbc0
commit
033548a760
@@ -71,7 +71,7 @@ final class HttpServiceMethod {
|
||||
HttpServiceMethod(
|
||||
Method method, Class<?> containingClass, List<HttpServiceArgumentResolver> argumentResolvers,
|
||||
HttpClientAdapter client, @Nullable StringValueResolver embeddedValueResolver,
|
||||
ReactiveAdapterRegistry reactiveRegistry, Duration blockTimeout) {
|
||||
ReactiveAdapterRegistry reactiveRegistry, @Nullable Duration blockTimeout) {
|
||||
|
||||
this.method = method;
|
||||
this.parameters = initMethodParameters(method);
|
||||
@@ -275,7 +275,7 @@ final class HttpServiceMethod {
|
||||
private record ResponseFunction(
|
||||
Function<HttpRequestValues, Publisher<?>> responseFunction,
|
||||
@Nullable ReactiveAdapter returnTypeAdapter,
|
||||
boolean blockForOptional, Duration blockTimeout) {
|
||||
boolean blockForOptional, @Nullable Duration blockTimeout) {
|
||||
|
||||
private ResponseFunction(
|
||||
Function<HttpRequestValues, Publisher<?>> responseFunction,
|
||||
@@ -298,8 +298,10 @@ final class HttpServiceMethod {
|
||||
}
|
||||
|
||||
return (this.blockForOptional ?
|
||||
((Mono<?>) responsePublisher).blockOptional(this.blockTimeout) :
|
||||
((Mono<?>) responsePublisher).block(this.blockTimeout));
|
||||
(this.blockTimeout != null ? ((Mono<?>) responsePublisher).blockOptional(this.blockTimeout) :
|
||||
((Mono<?>) responsePublisher).blockOptional()) :
|
||||
(this.blockTimeout != null ? ((Mono<?>) responsePublisher).block(this.blockTimeout) :
|
||||
((Mono<?>) responsePublisher).block()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -66,13 +66,14 @@ public final class HttpServiceProxyFactory {
|
||||
|
||||
private final ReactiveAdapterRegistry reactiveAdapterRegistry;
|
||||
|
||||
@Nullable
|
||||
private final Duration blockTimeout;
|
||||
|
||||
|
||||
private HttpServiceProxyFactory(
|
||||
HttpClientAdapter clientAdapter, List<HttpServiceArgumentResolver> argumentResolvers,
|
||||
@Nullable StringValueResolver embeddedValueResolver,
|
||||
ReactiveAdapterRegistry reactiveAdapterRegistry, Duration blockTimeout) {
|
||||
ReactiveAdapterRegistry reactiveAdapterRegistry, @Nullable Duration blockTimeout) {
|
||||
|
||||
this.clientAdapter = clientAdapter;
|
||||
this.argumentResolvers = argumentResolvers;
|
||||
@@ -208,7 +209,8 @@ public final class HttpServiceProxyFactory {
|
||||
/**
|
||||
* Configure how long to wait for a response for an HTTP service method
|
||||
* with a synchronous (blocking) method signature.
|
||||
* <p>By default this is 5 seconds.
|
||||
* <p>By default this is {@code null},
|
||||
* in which case means blocking on publishers is done without a timeout.
|
||||
* @param blockTimeout the timeout value
|
||||
* @return this same builder instance
|
||||
*/
|
||||
@@ -226,7 +228,7 @@ public final class HttpServiceProxyFactory {
|
||||
return new HttpServiceProxyFactory(
|
||||
this.clientAdapter, initArgumentResolvers(),
|
||||
this.embeddedValueResolver, this.reactiveAdapterRegistry,
|
||||
(this.blockTimeout != null ? this.blockTimeout : Duration.ofSeconds(5)));
|
||||
this.blockTimeout);
|
||||
}
|
||||
|
||||
private List<HttpServiceArgumentResolver> initArgumentResolvers() {
|
||||
|
||||
Reference in New Issue
Block a user