Class CachedTokenRefresher<TokenT extends SdkToken>
- java.lang.Object
-
- software.amazon.awssdk.awscore.internal.token.CachedTokenRefresher<TokenT>
-
- All Implemented Interfaces:
AutoCloseable
,TokenRefresher<TokenT>
,SdkAutoCloseable
@ThreadSafe public final class CachedTokenRefresher<TokenT extends SdkToken> extends Object implements TokenRefresher<TokenT>
Class to cache Tokens which are supplied by the Suppliers while constructing this class. Automatic refresh can be enabled by setting autoRefreshDuration in builder methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CachedTokenRefresher.Builder<TokenT extends SdkToken>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CachedTokenRefresher.Builder
builder()
Builder method to construct instance of CachedTokenRefresher.void
close()
TokenT
refreshIfStaleAndFetch()
Gets the fresh token from the service or provided suppliers.
-
-
-
Method Detail
-
builder
public static CachedTokenRefresher.Builder builder()
Builder method to construct instance of CachedTokenRefresher.- Returns:
-
refreshIfStaleAndFetch
public TokenT refreshIfStaleAndFetch()
Description copied from interface:TokenRefresher
Gets the fresh token from the service or provided suppliers.- Specified by:
refreshIfStaleAndFetch
in interfaceTokenRefresher<TokenT extends SdkToken>
- Returns:
- Fresh AwsToken as supplied by suppliers.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSdkAutoCloseable
-
-