This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.lang.ref
class ReferenceQueue

java.lang.Object extended by java.lang.ref.ReferenceQueue

Most common way to construct:

ReferenceQueue queue = new ReferenceQueue();

Based on 75 examples


public class ReferenceQueue
extends Object

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


Constructor Summary

          Constructs a new reference-object queue.
 
Method Summary
 Reference

          Polls this queue to see if a reference object is available.
 Reference

          Removes the next reference object in this queue, blocking until one becomes available.
 Reference
remove(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceQueue

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

Method Detail

poll

public Reference 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

public Reference remove()
                 throws 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 - If the wait is interrupted

remove

public Reference remove(long timeout)
                 throws IllegalArgumentException,
                        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 {@link Object#wait(long)} method.

Parameters:
timeout - If positive, block for up to 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 - If the value of the timeout argument is negative
InterruptedException - If the timeout wait is interrupted


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.