/** * 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 <tt>null</tt>. * * @return A reference object, if one was immediately available, * otherwise <code>null</code> */ public Reference<? extends T> poll() { if (head == null) return null; synchronized (lock) { return reallyPoll(); } }
/** * 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 <tt>null</tt>. * * @return A reference object, if one was immediately available, * otherwise <code>null</code> */ public Reference<? extends T> poll() { if (head == null) return null; synchronized (lock) { return reallyPoll(); } }
Reference<? extends T> r = reallyPoll(); if (r != null) return r; for (;;) { lock.wait(timeout); r = reallyPoll(); if (r != null) return r; if (timeout != 0) return null;
Reference<? extends T> r = reallyPoll(); if (r != null) return r; for (;;) { lock.wait(timeout); r = reallyPoll(); if (r != null) return r; if (timeout != 0) return null;