/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { afterPutEvts = new BlockingArrayQueue<>(); afterRmvEvts = new BlockingArrayQueue<>(); }
@Override public int remainingCapacity() { _tailLock.lock(); try { _headLock.lock(); try { return getCapacity() - size(); } finally { _headLock.unlock(); } } finally { _tailLock.unlock(); } }
BlockingArrayQueue<String> baq = new BlockingArrayQueue<>(); baq.add("test"); baq.listIterator().hasNext();
@Override public E element() { E e = peek(); if (e == null) throw new NoSuchElementException(); return e; }
@Override public E remove() { E e = poll(); if (e == null) throw new NoSuchElementException(); return e; }
@Override public boolean add(E e) { if (offer(e)) return true; else throw new IllegalStateException(); }
try if (!grow()) return false;
public void put(E o) throws InterruptedException { if (!add(o)) throw new IllegalStateException("full"); }
@Override public Iterator<E> iterator() { return listIterator(); }
BlockingArrayQueue<String> baq = new BlockingArrayQueue<>(); baq.add("test"); baq.listIterator().hasNext();
public E element() { E e = peek(); if (e==null) throw new NoSuchElementException(); return e; }
public E remove() { E e=poll(); if (e==null) throw new NoSuchElementException(); return e; }
@Override public boolean add(E e) { return offer(e); }
try if (!grow()) return false;
public void put(E o) throws InterruptedException { if (!add(o)) throw new IllegalStateException("full"); }
@Override public Iterator<E> iterator() { return listIterator(); }
protected ThreadPool createThreadPool(MetricRegistry metricRegistry) { final BlockingQueue<Runnable> queue = new BlockingArrayQueue<>(minThreads, maxThreads, maxQueuedRequests); final InstrumentedQueuedThreadPool threadPool = new InstrumentedQueuedThreadPool(metricRegistry, maxThreads, minThreads, (int) idleThreadTimeout.toMilliseconds(), queue); threadPool.setName("dw"); return threadPool; }