Home » Core Java » lang » ReferenceQueue

ReferenceQueue

Check when an object will be reclaimed

This is an example of how to check when an object will be reclaimed. Checking when an object will be reclaimed implies that you should: Create a new Object. Create a new ReferenceQueue, to which registered reference objects are appended by the garbage collector after the appropriate reachability changes are detected. Create a new PhantomReference that refers to the given ...

Read More »

Check when an object is no longer referenced

In this example we shall show you how to check when an object is no longer referenced. To check when an object is no longer referenced one should perform the following steps: Create a new Object. Create a new ReferenceQueue, to which registered reference objects are appended by the garbage collector after the appropriate reachability changes are detected. Create a ...

Read More »