java.lang.ref
Class ReferenceQueue<T>

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.lang.ref.ReferenceQueue<T>

public class ReferenceQueue<T>
extends Object sample code for java.lang.Object definition code for java.lang.Object

Reference queues, to which registered reference objects are appended by the garbage collector after the appropriate reachability changes are detected.

Since:
1.2

Constructor Summary
ReferenceQueue sample code for java.lang.ref.ReferenceQueue.ReferenceQueue() definition code for java.lang.ref.ReferenceQueue.ReferenceQueue() ()
          Constructs a new reference-object queue.
 
Method Summary
 Reference sample code for java.lang.ref.Reference definition code for java.lang.ref.Reference <? extends T> poll sample code for java.lang.ref.ReferenceQueue.poll() definition code for java.lang.ref.ReferenceQueue.poll() ()
          Polls this queue to see if a reference object is available.
 Reference sample code for java.lang.ref.Reference definition code for java.lang.ref.Reference <? extends T> remove sample code for java.lang.ref.ReferenceQueue.remove() definition code for java.lang.ref.ReferenceQueue.remove() ()
          Removes the next reference object in this queue, blocking until one becomes available.
 Reference sample code for java.lang.ref.Reference definition code for java.lang.ref.Reference <? extends T> remove sample code for java.lang.ref.ReferenceQueue.remove(long) definition code for java.lang.ref.ReferenceQueue.remove(long) (long timeout)
          Removes the next reference object in this queue, blocking until either one becomes available or the given timeout period expires.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

ReferenceQueue sample code for java.lang.ref.ReferenceQueue() definition code for java.lang.ref.ReferenceQueue()

public ReferenceQueue()
Constructs a new reference-object queue.

Method Detail

poll sample code for java.lang.ref.ReferenceQueue.poll() definition code for java.lang.ref.ReferenceQueue.poll()

public Reference sample code for java.lang.ref.Reference definition code for java.lang.ref.Reference <? extends T> poll()
Polls this queue to see if a reference object is available. If one is available without further delay then it is removed from the queue and returned. Otherwise this method immediately returns null.

Returns:
A reference object, if one was immediately available, otherwise null

remove sample code for java.lang.ref.ReferenceQueue.remove(long) definition code for java.lang.ref.ReferenceQueue.remove(long)

public Reference sample code for java.lang.ref.Reference definition code for java.lang.ref.Reference <? extends T> remove(long timeout)
                              throws IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException ,
                                     InterruptedException sample code for java.lang.InterruptedException definition code for java.lang.InterruptedException 
Removes the next reference object in this queue, blocking until either one becomes available or the given timeout period expires.

This method does not offer real-time guarantees: It schedules the timeout as if by invoking the Object.wait(long) sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) method.

Parameters:
timeout - If positive, block for up timeout milliseconds while waiting for a reference to be added to this queue. If zero, block indefinitely.
Returns:
A reference object, if one was available within the specified timeout period, otherwise null
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - If the value of the timeout argument is negative
InterruptedException sample code for java.lang.InterruptedException definition code for java.lang.InterruptedException - If the timeout wait is interrupted

remove sample code for java.lang.ref.ReferenceQueue.remove() definition code for java.lang.ref.ReferenceQueue.remove()

public Reference sample code for java.lang.ref.Reference definition code for java.lang.ref.Reference <? extends T> remove()
                              throws InterruptedException sample code for java.lang.InterruptedException definition code for java.lang.InterruptedException 
Removes the next reference object in this queue, blocking until one becomes available.

Returns:
A reference object, blocking until one becomes available
Throws:
InterruptedException sample code for java.lang.InterruptedException definition code for java.lang.InterruptedException - If the wait is interrupted