Class CachedTokenRefresher.Builder<TokenT extends SdkToken>
java.lang.Object
software.amazon.awssdk.awscore.internal.token.CachedTokenRefresher.Builder<TokenT>
- Enclosing class:
CachedTokenRefresher<TokenT extends SdkToken>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasyncRefreshEnabled(Boolean asyncRefreshEnabled) Configure whether this refresher should fetch tokens asynchronously in the background.build()exceptionHandler(Function<SdkException, TokenT> exceptionHandler) prefetchTime(Duration prefetchTime) Configure the amount of time, relative to SSO session token expiration, that the cached credentials are considered close to stale and should be updated.staleDuration(Duration staleDuration) tokenRetriever(Supplier<TokenT> tokenRetriever)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
tokenRetriever
- Parameters:
tokenRetriever- Supplier to retrieve the token from its respective sources.- Returns:
-
staleDuration
- Parameters:
staleDuration- The time before which the token is marked as stale to indicate it is time to fetch a fresh token.- Returns:
-
prefetchTime
Configure the amount of time, relative to SSO session token expiration, that the cached credentials are considered close to stale and should be updated. SeeasyncRefreshEnabled.By default, this is 5 minutes.
-
asyncRefreshEnabled
Configure whether this refresher should fetch tokens asynchronously in the background. If this is true, threads are less likely to block whenCachedTokenRefresher.refreshIfStaleAndFetch()()} is called, but additional resources are used to maintain the provider.By default, this is disabled.
-
exceptionHandler
public CachedTokenRefresher.Builder exceptionHandler(Function<SdkException, TokenT> exceptionHandler) - Parameters:
exceptionHandler- Handler which takes action when a Runtime exception occurs while fetching a token. Handler can return a previously stored token or throw back the exception.- Returns:
-
build
-