Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.lang.ref

Class ReferenceQueue

java.lang.Object
|
+--java.lang.ref.ReferenceQueue


public class ReferenceQueue

extends Object

This is the queue, where references can enqueue themselve on. Each reference may be registered to a queue at initialization time and will be appended to the queue, when the enqueue method is called. The enqueue method may be automatically called by the garbage collector if it detects, that the object is only reachable through the Reference objects.

Author:See Also:

Constructor Summary

ReferenceQueue()

Creates a new empty reference queue.

Method Summary

synchronized java.lang.ref.Referencepoll()

Checks if there is a reference on the queue, returning it immediately.
synchronized java.lang.ref.Referenceremove(long timeout)

Removes a reference from the queue, blocking for timeout until a reference is enqueued.
java.lang.ref.Referenceremove()

Removes a reference from the queue, blocking until a reference is enqueued.

Constructor Details

ReferenceQueue

public ReferenceQueue()

Creates a new empty reference queue.


Method Details

poll

public synchronized Reference poll()

Checks if there is a reference on the queue, returning it immediately. The reference will be dequeued.

Returns:


remove

public Reference remove()

Removes a reference from the queue, blocking until a reference is enqueued.

Returns:

Throws:


remove

public synchronized Reference remove(long timeout)

Removes a reference from the queue, blocking for timeout until a reference is enqueued.

Parameters:

Returns:

Throws: