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

Method getAndRecordStats

output/java_guava/1.4.13/LocalCache.java:2416–2436  ·  view source on GitHub ↗

Waits uninterruptibly for newValue to be loaded, and then records loading stats.

(
        K key,
        int hash,
        LoadingValueReference<K, V> loadingValueReference,
        ListenableFuture<V> newValue)

Source from the content-addressed store, hash-verified

2414 */
2415
2416 V getAndRecordStats(
2417 K key,
2418 int hash,
2419 LoadingValueReference<K, V> loadingValueReference,
2420 ListenableFuture<V> newValue) throws ExecutionException {
2421 V value = null;
2422 try {
2423 value = getUninterruptibly(newValue);
2424 if (value == null) {
2425 throw new InvalidCacheLoadException("CacheLoader returned null for key " + key + ".");
2426 }
2427 statsCounter.recordLoadSuccess(loadingValueReference.elapsedNanos());
2428 storeLoadedValue(key, hash, loadingValueReference, value);
2429 return value;
2430 } finally {
2431 if (value == null) {
2432 statsCounter.recordLoadException(loadingValueReference.elapsedNanos());
2433 removeLoadingValue(key, hash, loadingValueReference);
2434 }
2435 }
2436 }
2437
2438 V scheduleRefresh(ReferenceEntry<K, V> entry, K key, int hash, V oldValue, long now, CacheLoader<? super K, V> loader) {
2439 if (map.refreshes()

Callers 2

loadSyncMethod · 0.95
runMethod · 0.95

Calls 6

storeLoadedValueMethod · 0.95
removeLoadingValueMethod · 0.95
recordLoadSuccessMethod · 0.65
recordLoadExceptionMethod · 0.65
getUninterruptiblyMethod · 0.45
elapsedNanosMethod · 0.45

Tested by

no test coverage detected