Skip to content

Commit ff54eb8

Browse files
committed
Use Schedulers.boundedElastic()
Fixes gh-7457
1 parent cb5c58e commit ff54eb8

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

core/src/main/java/org/springframework/security/authentication/ReactiveAuthenticationManagerAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class ReactiveAuthenticationManagerAdapter implements ReactiveAuthenticationManager {
3535
private final AuthenticationManager authenticationManager;
3636

37-
private Scheduler scheduler = Schedulers.elastic();
37+
private Scheduler scheduler = Schedulers.boundedElastic();
3838

3939
public ReactiveAuthenticationManagerAdapter(AuthenticationManager authenticationManager) {
4040
Assert.notNull(authenticationManager, "authenticationManager cannot be null");

gradle/dependency-management.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if (!project.hasProperty('reactorVersion')) {
2-
ext.reactorVersion = 'Dysprosium-RC1'
2+
ext.reactorVersion = 'Dysprosium-BUILD-SNAPSHOT'
33
}
44

55
if (!project.hasProperty('springVersion')) {

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunction.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,10 @@ private Mono<OAuth2AuthorizedClient> authorizeClient(String clientRegistrationId
463463
});
464464
OAuth2AuthorizeRequest authorizeRequest = builder.build();
465465

466-
// NOTE: 'authorizedClientManager.authorize()' needs to be executed on a dedicated thread via subscribeOn(Schedulers.elastic())
466+
// NOTE: 'authorizedClientManager.authorize()' needs to be executed on a dedicated thread via subscribeOn(Schedulers.boundedElastic())
467+
// NOTE: 'authorizedClientManager.authorize()' needs to be executed on a dedicated thread via subscribeOn(Schedulers.boundedElastic())
467468
// since it performs a blocking I/O operation using RestTemplate internally
468-
return Mono.fromSupplier(() -> this.authorizedClientManager.authorize(authorizeRequest)).subscribeOn(Schedulers.elastic());
469+
return Mono.fromSupplier(() -> this.authorizedClientManager.authorize(authorizeRequest)).subscribeOn(Schedulers.boundedElastic());
469470
}
470471

471472
private Mono<OAuth2AuthorizedClient> authorizedClient(OAuth2AuthorizedClient authorizedClient, ClientRequest request) {
@@ -491,9 +492,9 @@ private Mono<OAuth2AuthorizedClient> authorizedClient(OAuth2AuthorizedClient aut
491492
});
492493
OAuth2AuthorizeRequest reauthorizeRequest = builder.build();
493494

494-
// NOTE: 'authorizedClientManager.authorize()' needs to be executed on a dedicated thread via subscribeOn(Schedulers.elastic())
495+
// NOTE: 'authorizedClientManager.authorize()' needs to be executed on a dedicated thread via subscribeOn(Schedulers.boundedElastic())
495496
// since it performs a blocking I/O operation using RestTemplate internally
496-
return Mono.fromSupplier(() -> this.authorizedClientManager.authorize(reauthorizeRequest)).subscribeOn(Schedulers.elastic());
497+
return Mono.fromSupplier(() -> this.authorizedClientManager.authorize(reauthorizeRequest)).subscribeOn(Schedulers.boundedElastic());
497498
}
498499

499500
private ClientRequest bearer(ClientRequest request, OAuth2AuthorizedClient authorizedClient) {

0 commit comments

Comments
 (0)