V
- input type of the function parameterE
- supported exception type of the function parameterpublic final class AsyncRefreshableSupplier<V,E extends Exception> extends Object
Constructor and Description |
---|
AsyncRefreshableSupplier(AsyncFunction<Context,V,E> compute)
Creates a provider ensuring "only-once" invocation of the given compute function.
|
Modifier and Type | Method and Description |
---|---|
Promise<V,E> |
get(Context context)
Computes (or re-computes) the value in a thread-safe manner, making sure that only 1 thread
will compute the value, the other being blocked, waiting for the result to be computed.
|
Promise<V,E> |
refresh(Context context)
Refresh (and returns) the value, in a thread-safe manner.
|
public AsyncRefreshableSupplier(AsyncFunction<Context,V,E> compute)
compute
- computation functionpublic Promise<V,E> get(Context context)
context
- Service contextpublic Promise<V,E> refresh(Context context)
It works like this:
context
- Service contextCopyright 2011-2017 ForgeRock AS.