T
- the type of enqueued objectspublic final class ReferenceQueue<T> extends Object
There are two ways to retrieve and remove an element from the queue.
EnqueuedWeakReference
Constructor and Description |
---|
ReferenceQueue()
Creates an empty
Reference queue. |
Modifier and Type | Method and Description |
---|---|
EnqueuedWeakReference<T> |
poll()
Queries the queue and returns and removes the first element of the queue.
|
EnqueuedWeakReference<T> |
remove()
Queries the queue, returns and removes the first element of the queue.
|
public ReferenceQueue()
Reference
queue.@Nullable public EnqueuedWeakReference<T> poll()
null
.null
public EnqueuedWeakReference<T> remove() throws InterruptedException
InterruptedException
- if the thread is interrupted