public Object peekLast() { lock.lock(); try { return (last == null) ? null : last.item; } finally { lock.unlock(); } }
public Object peek() { final ReentrantLock lock = this.lock; lock.lock(); try { return (count == 0) ? null : items[takeIndex]; } finally { lock.unlock(); } }
public int size() { int s; final ReentrantLock lock = this.lock; lock.lock(); try { s = size; } finally { lock.unlock(); } return s; }
public Object peek() { final ReentrantLock lock = this.lock; lock.lock(); try { return (count == 0) ? null : items[takeIndex]; } finally { lock.unlock(); } }
/** * @throws NullPointerException {@inheritDoc} */ public boolean offerFirst(Object e) { if (e == null) throw new NullPointerException(); lock.lock(); try { return linkFirst(e); } finally { lock.unlock(); } }
/** * @throws NullPointerException {@inheritDoc} */ public boolean offerLast(Object e) { if (e == null) throw new NullPointerException(); lock.lock(); try { return linkLast(e); } finally { lock.unlock(); } }
/** * @throws NullPointerException {@inheritDoc} */ public boolean offerLast(Object e) { if (e == null) throw new NullPointerException(); lock.lock(); try { return linkLast(e); } finally { lock.unlock(); } }
public Object peek() { final ReentrantLock lock = this.lock; lock.lock(); try { return q.peek(); } finally { lock.unlock(); } }
public Object pollFirst() { lock.lock(); try { return unlinkFirst(); } finally { lock.unlock(); } }
public String toString() { final ReentrantLock lock = this.lock; lock.lock(); try { return q.toString(); } finally { lock.unlock(); } }
public Object pollLast() { lock.lock(); try { return unlinkLast(); } finally { lock.unlock(); } }
public Object poll() { final ReentrantLock lock = this.lock; lock.lock(); try { if (count == 0) return null; Object x = extract(); return x; } finally { lock.unlock(); } }
public Object[] toArray() { final ReentrantLock lock = this.lock; lock.lock(); try { return Arrays.copyOf(queue, size); } finally { lock.unlock(); } }
public String toString() { lock.lock(); try { return super.toString(); } finally { lock.unlock(); } }
public Object[] toArray() { final ReentrantLock lock = this.lock; lock.lock(); try { return Arrays.copyOf(queue, size); } finally { lock.unlock(); } }
public Object poll() { final ReentrantLock lock = this.lock; lock.lock(); try { if (count == 0) return null; Object x = extract(); return x; } finally { lock.unlock(); } }
/** * {@inheritDoc} */ public void unlock() { // must unpin w/lock held if (resolvedLock.getHoldCount() == 1) unpin(resolvedLock); resolvedLock.unlock(); }
public String toString() { lock.lock(); try { return super.toString(); } finally { lock.unlock(); } }
public Object takeFirst() throws InterruptedException { lock.lock(); try { Object x; while ( (x = unlinkFirst()) == null) notEmpty.await(); return x; } finally { lock.unlock(); } }
public Object takeLast() throws InterruptedException { lock.lock(); try { Object x; while ( (x = unlinkLast()) == null) notEmpty.await(); return x; } finally { lock.unlock(); } }