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

Method get

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 13

getEntryMethod · 0.95
getLiveValueMethod · 0.95
recordReadMethod · 0.95
scheduleRefreshMethod · 0.95
waitForLoadingValueMethod · 0.95
lockedGetOrLoadMethod · 0.95
postReadCleanupMethod · 0.95
recordHitsMethod · 0.65
getValueReferenceMethod · 0.65
isLoadingMethod · 0.65
checkNotNullMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected