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.Constructor and Description |
---|
NuxeoBlockingQueue() |
Modifier and Type | Method and Description |
---|---|
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() |
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() |
void |
setActive(boolean active)
Sets the queue active or inactive.
|
int |
size() |
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, poll, remove, take
public void setActive(boolean active)
active
- true
to make the queue active, or false
to
deactivate itpublic boolean offer(Runnable r)
public boolean offer(Runnable r, long timeout, TimeUnit unit) throws InterruptedException
offer
in interface BlockingQueue<Runnable>
InterruptedException
public void put(Runnable r) throws InterruptedException
put
in interface BlockingQueue<Runnable>
InterruptedException
public 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
InterruptedException
public abstract Runnable pollElement()
Copyright © 2014 Nuxeo SA. All rights reserved.