public class ReferenceQueue extends Object
Constructor and Description |
---|
ReferenceQueue()
Create a new ReferenceQueue.
|
Modifier and Type | Method and Description |
---|---|
Reference |
poll()
Polls this queue to see if a reference object is available, returning one immediately if so.
|
Reference |
remove()
Return and remove the next Reference in the Queue, waiting indefinitely until one
is available.
|
Reference |
remove(long waitTime) |
public Reference poll()
public Reference remove(long waitTime) throws InterruptedException, IllegalArgumentException
waitTime
- the length of time to wait in milliseconds for a Reference to become available.
If this is zero, the Thread will wait indefinitely. If it is positive it will wait
for the specified time.InterruptedException
- if the wait was interrupted.IllegalArgumentException
- if waitTime is negative.public Reference remove() throws InterruptedException
InterruptedException