Methods Summary |
---|
synchronized void | enqueue(java.lang.ref.Reference toQueue)Enqueues the reference object on the receiver.
if (head == null) {
toQueue.queueNext = toQueue;
} else {
toQueue.queueNext = head;
}
head = toQueue;
notify();
|
public synchronized java.lang.ref.Reference | poll()Returns the next available reference from the queue, removing it in the
process. Does not wait for a reference to become available.
if (head == null) {
return null;
}
Reference<? extends T> ret;
ret = head;
if (head == head.queueNext) {
head = null;
} else {
head = head.queueNext;
}
ret.queueNext = null;
return ret;
|
public java.lang.ref.Reference | remove()Returns the next available reference from the queue, removing it in the
process. Waits indefinitely for a reference to become available.
return remove(0L);
|
public synchronized java.lang.ref.Reference | remove(long timeout)Returns the next available reference from the queue, removing it in the
process. Waits for a reference to become available or the given timeout
period to elapse, whichever happens first.
if (timeout < 0) {
throw new IllegalArgumentException();
}
if (timeout == 0L) {
while (head == null) {
wait(0L);
}
} else {
long now = System.currentTimeMillis();
long wakeupTime = now + timeout + 1L;
while (head == null && now < wakeupTime) {
wait(wakeupTime - now);
now = System.currentTimeMillis();
}
}
return poll();
|