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

Method loadAsync

output/java_guava/1.4.16/LocalCache.java:2401–2419  ·  view source on GitHub ↗
(
      final K key,
      final int hash,
      final LoadingValueReference<K, V> loadingValueReference,
      CacheLoader<? super K, V> loader)

Source from the content-addressed store, hash-verified

2399 }
2400
2401 ListenableFuture<V> loadAsync(
2402 final K key,
2403 final int hash,
2404 final LoadingValueReference<K, V> loadingValueReference,
2405 CacheLoader<? super K, V> loader) {
2406 final ListenableFuture<V> loadingFuture = loadingValueReference.loadFuture(key, loader);
2407 loadingFuture.addListener(new Runnable() {
2408 @Override
2409 public void run() {
2410 try {
2411 getAndRecordStats(key, hash, loadingValueReference, loadingFuture);
2412 } catch (Throwable t) {
2413 logger.log(Level.WARNING, "Exception thrown during refresh", t);
2414 loadingValueReference.setException(t);
2415 }
2416 }
2417 }, directExecutor());
2418 return loadingFuture;
2419 }
2420
2421 /**
2422 * Waits uninterruptibly for {@code newValue} to be loaded, and then records loading stats.

Callers 1

refreshMethod · 0.95

Calls 3

addListenerMethod · 0.65
loadFutureMethod · 0.45
directExecutorMethod · 0.45

Tested by

no test coverage detected