public class ReferenceQueue<T> extends Object
Reference.enqueue()
Constructor and Description |
---|
ReferenceQueue()
Creates a new empty reference queue.
|
Modifier and Type | Method and Description |
---|---|
Reference<? extends T> |
poll()
Checks if there is a reference on the queue, returning it
immediately.
|
Reference<? extends T> |
remove()
Removes a reference from the queue, blocking until a reference is
enqueued.
|
Reference<? extends T> |
remove(long timeout)
Removes a reference from the queue, blocking for
timeout
until a reference is enqueued. |
public ReferenceQueue()
public Reference<? extends T> poll()
null
otherwise.public Reference<? extends T> remove(long timeout) throws InterruptedException
timeout
until a reference is enqueued.timeout
- the timeout period in milliseconds, 0
means
wait forever.null
if timeout period expired.InterruptedException
- if the wait was interrupted.public Reference<? extends T> remove() throws InterruptedException
InterruptedException
- if the wait was interrupted.