oracle.ide.util
Class WeakDataReference<T>

The WeakDataReference class is an implementation of WeakReference with a built in notification mechanism. Upon determining that its data has been garbage collected, the WeakDataReference instance will notify its associated WeakDataHolder that the weakly referenced data has expired (i.e. been garbage collected).

The determination that the data has been garbage collected is governed by the behavior of the garbage collector's cooperation with the WeakDataReference's internal ReferenceQueue. That is to say that WeakDataReference notification to its WeakDataHolder can only occur after the garbage collector gets around to putting the WeakDataReference instance into the shared internal ReferenceQueue. The contents of the internal ReferenceQueue are examined regularly via a shared internal thread.

Notification sent by the WeakDataReference to the WeakDataHolder will occur on the AWT event thread.

WeakDataReference

holder - object to be notified some time after collection of the data.

data - object to be weakly referenced.

Method Detail

clear

public void clear()

Clears this reference object. Invoking this method will not cause this object to be enqueued, will result in the release of the internal reference to the WeakDataHolder, and will not result in notification to the WeakDataHolder upon any possible eventual garbage collection of the data.