Memory consistency effects:
The enqueueing of a reference to a queue (by the garbage collector, or by a
successful call to Reference#enqueue
)
happens-before
the reference is removed from the queue by ReferenceQueue#poll
or
ReferenceQueue#remove
.
Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
pack-priv static final ReferenceQueue | |
private volatile Reference | |
private final ReentrantLock | |
private final Condition | |
pack-priv static final ReferenceQueue | |
private long |
Access | Constructor and Description |
---|---|
public | |
pack-priv |
Modifier and Type | Method and Description |
---|---|
pack-priv void | |
pack-priv void | |
pack-priv boolean | |
pack-priv final boolean | |
pack-priv void | |
pack-priv final boolean | |
public Reference | Returns: A reference object, if one was immediately available, otherwisenull Polls this queue to see if a reference object is available. |
pack-priv final Reference | |
public Reference | Returns: A reference object, if one was available within the specified timeout period, otherwisenull If positive, block for up to timeout)timeout
milliseconds while waiting for a reference to be
added to this queue. If zero, block indefinitely.Removes the next reference object in this queue, blocking until either one becomes available or the given timeout period expires. |
public Reference | Returns: A reference object, blocking until one becomes availableRemoves the next reference object in this queue, blocking until one becomes available. |
pack-priv final Reference | |
pack-priv final Reference | |
pack-priv void |
ENQUEUED | back to summary |
---|---|
pack-priv static final ReferenceQueue<Object> ENQUEUED |
head | back to summary |
---|---|
private volatile Reference<? extends T> head |
lock | back to summary |
---|---|
private final ReentrantLock lock |
notEmpty | back to summary |
---|---|
private final Condition notEmpty |
NULL | back to summary |
---|---|
pack-priv static final ReferenceQueue<Object> NULL |
queueLength | back to summary |
---|---|
private long queueLength |
ReferenceQueue | back to summary |
---|---|
public ReferenceQueue() Constructs a new reference-object queue. |
ReferenceQueue | back to summary |
---|---|
pack-priv ReferenceQueue(int dummy) |
await | back to summary |
---|---|
pack-priv void await() throws InterruptedException |
await | back to summary |
---|---|
pack-priv void await(long timeoutMillis) throws InterruptedException |
enqueue | back to summary |
---|---|
pack-priv boolean enqueue(Reference<? extends T> r) |
enqueue0 | back to summary |
---|---|
pack-priv final boolean enqueue0(Reference<? extends T> r) |
forEach | back to summary |
---|---|
pack-priv void forEach(Consumer<? super Reference<? extends T>> action) Iterate queue and invoke given action with each Reference. Suitable for diagnostic purposes. Warning any use of this method should make sure to not retain the referents of iterated references (in case of FinalReference(s)) so that their life is not prolonged more than necessary. |
headIsNull | back to summary |
---|---|
pack-priv final boolean headIsNull() |
poll | back to summary |
---|---|
public Reference 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
|
poll0 | back to summary |
---|---|
pack-priv final Reference |
remove | back to summary |
---|---|
public Reference 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
|
remove | back to summary |
---|---|
public Reference Removes the next reference object in this queue, blocking until one becomes available.
|
remove0 | back to summary |
---|---|
pack-priv final Reference |
remove0 | back to summary |
---|---|
pack-priv final Reference |
signal | back to summary |
---|---|
pack-priv void signal() |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
pack-priv boolean |
Null | back to summary |
---|---|
public Null() |
enqueue | back to summary |
---|---|
pack-priv boolean enqueue(Reference<?> r) Overrides java.
|