public abstract class NuxeoBlockingQueue extends AbstractQueue<Runnable> implements BlockingQueue<Runnable>
BlockingQueue suitable for a fixed-sized ThreadPoolExecutor, that can be implemented in terms of a few methods. offer(java.lang.Runnable) always succeeds.| Modifier and Type | Field and Description | 
|---|---|
protected Condition | 
activation  | 
protected ReentrantLock | 
activationLock  | 
protected boolean | 
active  | 
protected String | 
queueId  | 
protected WorkQueuing | 
queuing  | 
| Modifier | Constructor and Description | 
|---|---|
protected  | 
NuxeoBlockingQueue(String queueId,
                  WorkQueuing queuing)  | 
| Modifier and Type | Method and Description | 
|---|---|
protected long | 
awaitActivation(long nanos)  | 
boolean | 
contains(Object o)  | 
int | 
drainTo(Collection<? super Runnable> c)  | 
int | 
drainTo(Collection<? super Runnable> c,
       int maxElements)  | 
abstract int | 
getQueueSize()
Gets the size of the queue. 
 | 
Iterator<Runnable> | 
iterator()  | 
protected abstract WorkQueueMetrics | 
metrics()  | 
boolean | 
offer(Runnable r)  | 
boolean | 
offer(Runnable r,
     long timeout,
     TimeUnit unit)  | 
Runnable | 
peek()  | 
Runnable | 
poll()  | 
abstract Runnable | 
pollElement()
Retrieves and removes an element from the queue, or returns null if the queue is empty. 
 | 
void | 
put(Runnable r)  | 
abstract void | 
putElement(Runnable r)
Adds an element into this queue, waiting if necessary for space to become available. 
 | 
int | 
remainingCapacity()  | 
WorkQueueMetrics | 
setActive(boolean active)
Sets the queue active or inactive. 
 | 
int | 
size()  | 
protected long | 
timeUntil(long end)  | 
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, poll, remove, takeaddAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayprotected final ReentrantLock activationLock
protected final Condition activation
protected volatile boolean active
protected final WorkQueuing queuing
protected NuxeoBlockingQueue(String queueId, WorkQueuing queuing)
protected abstract WorkQueueMetrics metrics()
public WorkQueueMetrics setActive(boolean active)
active - true to make the queue active, or false to deactivate itpublic boolean offer(Runnable r, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<Runnable>InterruptedExceptionpublic void put(Runnable r) throws InterruptedException
put in interface BlockingQueue<Runnable>InterruptedExceptionprotected long timeUntil(long end)
protected long awaitActivation(long nanos) throws InterruptedException
InterruptedExceptionpublic boolean contains(Object o)
contains in interface Collection<Runnable>contains in interface BlockingQueue<Runnable>contains in class AbstractCollection<Runnable>public int size()
size in interface Collection<Runnable>size in class AbstractCollection<Runnable>public int remainingCapacity()
remainingCapacity in interface BlockingQueue<Runnable>public Iterator<Runnable> iterator()
iterator in interface Iterable<Runnable>iterator in interface Collection<Runnable>iterator in class AbstractCollection<Runnable>public int drainTo(Collection<? super Runnable> c)
drainTo in interface BlockingQueue<Runnable>public int drainTo(Collection<? super Runnable> c, int maxElements)
drainTo in interface BlockingQueue<Runnable>public abstract int getQueueSize()
public abstract void putElement(Runnable r) throws InterruptedException
InterruptedExceptionpublic abstract Runnable pollElement()
Copyright © 2019 Nuxeo. All rights reserved.