Demonstration of reference queues.
Object obj = new Object();
WeakReference ref = new WeakReference(obj);
ReferenceQueue clearedObjects = new ReferenceQueue();
SoftReference ref2 = new SoftReference(obj, clearedObjects);
// just used to supress eclipse warnings.
ref.isEnqueued();
ref2.isEnqueued();