MCPcopy Create free account
hub / github.com/antlr/codebuff / refresh

Method refresh

output/java_guava/1.4.19/LocalCache.java:2471–2486  ·  view source on GitHub ↗

Refreshes the value associated with key, unless another thread is already doing so. Returns the newly refreshed value associated with key if it was refreshed inline, or null if another thread is performing the refresh or if an error occurs during refresh.

(K key, int hash, CacheLoader<? super K, V> loader, boolean checkTime)

Source from the content-addressed store, hash-verified

2469 */
2470
2471 @Nullable
2472 V refresh(K key, int hash, CacheLoader<? super K, V> loader, boolean checkTime) {
2473 final LoadingValueReference<K, V> loadingValueReference = insertLoadingValueReference(key, hash, checkTime);
2474 if (loadingValueReference == null) {
2475 return null;
2476 }
2477 ListenableFuture<V> result = loadAsync(key, hash, loadingValueReference, loader);
2478 if (result.isDone()) {
2479 try {
2480 return Uninterruptibles.getUninterruptibly(result);
2481 } catch (Throwable t) {
2482 // don't let refresh exceptions propagate; error was already logged
2483 }
2484 }
2485 return null;
2486 }
2487
2488 /**
2489 * Returns a newly inserted {@code LoadingValueReference}, or null if the live value reference

Callers 1

scheduleRefreshMethod · 0.95

Calls 4

loadAsyncMethod · 0.95
getUninterruptiblyMethod · 0.95
isDoneMethod · 0.45

Tested by

no test coverage detected