@@ -48,7 +48,7 @@ private enum TokenState {
4848 // Whether asynchronous refresh is enabled.
4949 private boolean asyncDisabled = false ;
5050 // The legacy duration before expiry to consider a token as 'stale'.
51- private final Duration staleDuration ;
51+ private final Duration staticStaleDuration ;
5252 // Whether to use the dynamic stale duration computation or defer to the legacy duration.
5353 private final boolean useDynamicStaleDuration ;
5454 // The dynamically computed duration before expiry to consider a token as 'stale'.
@@ -68,7 +68,7 @@ private enum TokenState {
6868 private CachedTokenSource (Builder builder ) {
6969 this .tokenSource = builder .tokenSource ;
7070 this .asyncDisabled = builder .asyncDisabled ;
71- this .staleDuration = builder .staleDuration ;
71+ this .staticStaleDuration = builder .staleDuration ;
7272 this .useDynamicStaleDuration = builder .useDynamicStaleDuration ;
7373 this .expiryBuffer = builder .expiryBuffer ;
7474 this .clockSupplier = builder .clockSupplier ;
@@ -77,7 +77,7 @@ private CachedTokenSource(Builder builder) {
7777 if (this .useDynamicStaleDuration && this .token != null ) {
7878 this .dynamicStaleDuration = computeStaleDuration (this .token );
7979 } else {
80- this .dynamicStaleDuration = MAX_STALE_DURATION ;
80+ this .dynamicStaleDuration = Duration . ofMinutes ( 0 ) ;
8181 }
8282 }
8383
@@ -238,8 +238,8 @@ protected TokenState getTokenState(Token t) {
238238 if (lifeTime .compareTo (expiryBuffer ) <= 0 ) {
239239 return TokenState .EXPIRED ;
240240 }
241- Duration usedStaleDuration = useDynamicStaleDuration ? dynamicStaleDuration : staleDuration ;
242- if (lifeTime .compareTo (usedStaleDuration ) <= 0 ) {
241+ Duration staleDuration = useDynamicStaleDuration ? dynamicStaleDuration : staticStaleDuration ;
242+ if (lifeTime .compareTo (staleDuration ) <= 0 ) {
243243 return TokenState .STALE ;
244244 }
245245 return TokenState .FRESH ;
0 commit comments