(ReferenceEntry<K, V> e, K key, ValueReference<K, V> valueReference)
| 2362 | } |
| 2363 | |
| 2364 | V waitForLoadingValue(ReferenceEntry<K, V> e, K key, ValueReference<K, V> valueReference) throws ExecutionException { |
| 2365 | if (!valueReference.isLoading()) { |
| 2366 | throw new AssertionError(); |
| 2367 | } |
| 2368 | checkState(!Thread.holdsLock(e), "Recursive load of: %s", key); |
| 2369 | // don't consider expiration as we're concurrent with loading |
| 2370 | try { |
| 2371 | V value = valueReference.waitForValue(); |
| 2372 | if (value == null) { |
| 2373 | throw new InvalidCacheLoadException("CacheLoader returned null for key " + key + "."); |
| 2374 | } |
| 2375 | // re-read ticker now that loading has completed |
| 2376 | |
| 2377 | long now = map.ticker.read(); |
| 2378 | recordRead(e, now); |
| 2379 | return value; |
| 2380 | } finally { |
| 2381 | statsCounter.recordMisses(1); |
| 2382 | } |
| 2383 | } |
| 2384 | |
| 2385 | // at most one of loadSync/loadAsync may be called for any given LoadingValueReference |
| 2386 |
no test coverage detected