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

Method get

output/java_guava/1.4.18/LocalCache.java:2257–2292  ·  view source on GitHub ↗
(K key, int hash, CacheLoader<? super K, V> loader)

Source from the content-addressed store, hash-verified

2255 // loading
2256
2257 V get(K key, int hash, CacheLoader<? super K, V> loader) throws ExecutionException {
2258 checkNotNull(key);
2259 checkNotNull(loader);
2260 try {
2261 if (count != 0) { // read-volatile
2262 // don't call getLiveEntry, which would ignore loading values
2263 ReferenceEntry<K, V> e = getEntry(key, hash);
2264 if (e != null) {
2265 long now = map.ticker.read();
2266 V value = getLiveValue(e, now);
2267 if (value != null) {
2268 recordRead(e, now);
2269 statsCounter.recordHits(1);
2270 return scheduleRefresh(e, key, hash, value, now, loader);
2271 }
2272 ValueReference<K, V> valueReference = e.getValueReference();
2273 if (valueReference.isLoading()) {
2274 return waitForLoadingValue(e, key, valueReference);
2275 }
2276 }
2277 }
2278
2279 // at this point e is either null or expired;
2280 return lockedGetOrLoad(key, hash, loader);
2281 } catch (ExecutionException ee) {
2282 Throwable cause = ee.getCause();
2283 if (cause instanceof Error) {
2284 throw new ExecutionError((Error) cause);
2285 } else if (cause instanceof RuntimeException) {
2286 throw new UncheckedExecutionException(cause);
2287 }
2288 throw ee;
2289 } finally {
2290 postReadCleanup();
2291 }
2292 }
2293
2294 V lockedGetOrLoad(K key, int hash, CacheLoader<? super K, V> loader) throws ExecutionException {
2295 ReferenceEntry<K, V> e;

Callers

nothing calls this directly

Calls 15

getEntryMethod · 0.95
getLiveValueMethod · 0.95
recordReadMethod · 0.95
scheduleRefreshMethod · 0.95
waitForLoadingValueMethod · 0.95
lockedGetOrLoadMethod · 0.95
postReadCleanupMethod · 0.95
getLiveEntryMethod · 0.95
recordHitsMethod · 0.65
getValueReferenceMethod · 0.65
isLoadingMethod · 0.65

Tested by

no test coverage detected