public interface WeakDataHolder<T>
Implementation classes should take care to include protective code within their implementations to ensure that they do not incorrectly respond to the notification beyond a valid state. For example; if a WeakDataHolder implementation can be closed, disposed, or otherwise rendered unusable, the implementation should be prepared to correctly handle being notified of its data expiring (i.e. garbage collected) even while in that unusable state.
To disassociate a WeakDataHolder from a given WeakDataReference, calling WeakDataReference.clear() on the WeakDataReference instance will remove the WeakDataReference's reference to the WeakDataHolder.
Modifier and Type | Method and Description |
---|---|
void |
dataExpired(WeakDataReference<T> data)
Notification that weakly referenced data held by the given
WeakDataReference instance, of which this WeakDataHolder was provided as
the holder, has been garbage collected.
|
boolean |
isExpired()
Determine whether or not the weakly referenced data has expired.
|
void dataExpired(WeakDataReference<T> data)
data
- boolean isExpired()