Skip to content

Commit a2e8f14

Browse files
committed
Ensure that caching is also done in a single thread
1 parent 58cfaf1 commit a2e8f14

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/tokenprovider/AbstractUaaTokenProvider.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,6 @@ private Mono<String> token(final ConnectionContext connectionContext) {
336336
}
337337

338338
final Mono<String> baseTokenRequest = createTokenRequest(connectionContext)
339-
/*
340-
* Ensure execution on single thread.
341-
* This prevents sending requests to the UAA server with expired refresh tokens.
342-
*/
343-
.publishOn(connectionContext.getTokenScheduler())
344339
.doOnSubscribe(s -> LOGGER.debug("Starting new UAA JWT token request"))
345340
.doOnSuccess(token -> LOGGER.debug("UAA JWT token request completed successfully"))
346341
.doOnError(error -> LOGGER.debug("UAA JWT token request failed", error))
@@ -353,7 +348,12 @@ private Mono<String> token(final ConnectionContext connectionContext) {
353348
final Mono<String> newTokenRequest = connectionContext
354349
.getCacheDuration()
355350
.map(baseTokenRequest::cache)
356-
.orElseGet(baseTokenRequest::cache);
351+
.orElseGet(baseTokenRequest::cache)
352+
/*
353+
* Ensure execution on single thread.
354+
* This prevents sending requests to the UAA server with expired refresh tokens.
355+
*/
356+
.publishOn(connectionContext.getTokenScheduler());
357357

358358
// Store the active request atomically
359359
final Mono<String> actualRequest = this.activeTokenRequests.putIfAbsent(connectionContext, newTokenRequest);

0 commit comments

Comments
 (0)