Gets the value from an entry. Returns null if the entry is invalid, partially-collected, loading, or expired. Unlike Segment#getLiveValue this method does not attempt to cleanup stale entries. As such it should only be called outside of a segment context, such as during iteration.
(ReferenceEntry<K, V> entry, long now)
| 1892 | * during iteration. |
| 1893 | */ |
| 1894 | @Nullable |
| 1895 | V getLiveValue(ReferenceEntry<K, V> entry, long now) { |
| 1896 | if (entry.getKey() == null) { |
| 1897 | return null; |
| 1898 | } |
| 1899 | V value = entry.getValueReference().get(); |
| 1900 | if (value == null) { |
| 1901 | return null; |
| 1902 | } |
| 1903 | |
| 1904 | if (isExpired(entry, now)) { |
| 1905 | return null; |
| 1906 | } |
| 1907 | return value; |
| 1908 | } |
| 1909 | |
| 1910 | // expiration |
| 1911 |
no test coverage detected