static class LocalCache.WeakValueReference<K,V> extends java.lang.ref.WeakReference<V> implements LocalCache.ValueReference<K,V>
Modifier and Type | Field and Description |
---|---|
(package private) ReferenceEntry<K,V> |
entry |
Constructor and Description |
---|
WeakValueReference(java.lang.ref.ReferenceQueue<V> queue,
V referent,
ReferenceEntry<K,V> entry) |
Modifier and Type | Method and Description |
---|---|
LocalCache.ValueReference<K,V> |
copyFor(java.lang.ref.ReferenceQueue<V> queue,
V value,
ReferenceEntry<K,V> entry)
Creates a copy of this reference for the given entry.
|
ReferenceEntry<K,V> |
getEntry()
Returns the entry associated with this value reference, or
null if this value
reference is independent of any entry. |
int |
getWeight()
Returns the weight of this entry.
|
boolean |
isActive()
Returns true if this reference contains an active value, meaning one that is still considered
present in the cache.
|
boolean |
isLoading()
Returns true if a new value is currently loading, regardless of whether or not there is an
existing value.
|
void |
notifyNewValue(V newValue)
Notify pending loads that a new value was set.
|
V |
waitForValue()
Waits for a value that may still be loading.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get
final ReferenceEntry<K,V> entry
WeakValueReference(java.lang.ref.ReferenceQueue<V> queue, V referent, ReferenceEntry<K,V> entry)
public int getWeight()
LocalCache.ValueReference
getWeight
in interface LocalCache.ValueReference<K,V>
public ReferenceEntry<K,V> getEntry()
LocalCache.ValueReference
null
if this value
reference is independent of any entry.getEntry
in interface LocalCache.ValueReference<K,V>
public void notifyNewValue(V newValue)
LocalCache.ValueReference
notifyNewValue
in interface LocalCache.ValueReference<K,V>
public LocalCache.ValueReference<K,V> copyFor(java.lang.ref.ReferenceQueue<V> queue, V value, ReferenceEntry<K,V> entry)
LocalCache.ValueReference
value
may be null only for a loading reference.
copyFor
in interface LocalCache.ValueReference<K,V>
public boolean isLoading()
LocalCache.ValueReference
isLoading
in interface LocalCache.ValueReference<K,V>
public boolean isActive()
LocalCache.ValueReference
isActive
in interface LocalCache.ValueReference<K,V>
public V waitForValue()
LocalCache.ValueReference
waitForValue
in interface LocalCache.ValueReference<K,V>