Class NonBlocking
java.lang.Object
software.amazon.awssdk.utils.cache.NonBlocking
- All Implemented Interfaces:
AutoCloseable,CachedSupplier.PrefetchStrategy,SdkAutoCloseable
A
CachedSupplier.PrefetchStrategy that will run a single thread in the background to update the value. A call to
prefetch on this strategy will never return.
Multiple calls to prefetch(Runnable) will still only result in one background task performing the update.-
Constructor Summary
ConstructorsConstructorDescriptionNonBlocking(String asyncThreadName) Create a non-blocking prefetch strategy that uses the provided value for the name of the background thread that will be performing the update. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Free any resources associated with the strategy.<T> RefreshResult<T> fetch(Supplier<RefreshResult<T>> supplier) Invoke the provided supplier to retrieve the refresh result.voidinitializeCachedSupplier(CachedSupplier<?> cachedSupplier) Invoked when the prefetch strategy is registered with aCachedSupplier.booleanvoidExecute the provided value updater to update the cache.voidrunWithInstanceThreadName(Runnable runnable) voidtryRunBackgroundTask(Runnable runnable) voidtryRunBackgroundTask(Runnable runnable, Runnable runOnCompletion) voidupdateTask(ScheduledFuture<?> newTask)
-
Constructor Details
-
NonBlocking
Create a non-blocking prefetch strategy that uses the provided value for the name of the background thread that will be performing the update.
-
-
Method Details
-
isTaskScheduled
-
initializeCachedSupplier
Description copied from interface:CachedSupplier.PrefetchStrategyInvoked when the prefetch strategy is registered with aCachedSupplier.- Specified by:
initializeCachedSupplierin interfaceCachedSupplier.PrefetchStrategy
-
prefetch
Description copied from interface:CachedSupplier.PrefetchStrategyExecute the provided value updater to update the cache. The specific implementation defines how this is invoked.- Specified by:
prefetchin interfaceCachedSupplier.PrefetchStrategy
-
fetch
Description copied from interface:CachedSupplier.PrefetchStrategyInvoke the provided supplier to retrieve the refresh result. This is useful for prefetch strategies to override when they care about the refresh result.- Specified by:
fetchin interfaceCachedSupplier.PrefetchStrategy
-
close
public void close()Description copied from interface:CachedSupplier.PrefetchStrategyFree any resources associated with the strategy. This is invoked when theCachedSupplier.close()method is invoked.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCachedSupplier.PrefetchStrategy- Specified by:
closein interfaceSdkAutoCloseable
-
updateTask
-
tryRunBackgroundTask
-
tryRunBackgroundTask
-
runWithInstanceThreadName
-