E - public class CTPBlockQueue<E> extends AbstractCTPQueue<E>
| 构造器和说明 |
|---|
CTPBlockQueue() |
CTPBlockQueue(int capacity) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear() |
protected boolean |
containsAllNodes(java.util.Collection<?> c) |
protected boolean |
containsNode(Node<java.lang.Object> o) |
protected java.util.Iterator<Node<E>> |
getIterator()
获取实现队列的迭代器
|
boolean |
isEmpty() |
boolean |
offer(E e,
long timeout,
java.util.concurrent.TimeUnit unit)
将元素e插入到队列末尾,如果插入成功,则返回true;队列已满,阻塞等待
|
protected boolean |
offerNode(Node<E> node)
将元素e插入到队列末尾,如果插入成功,则返回true;如果插入失败(即队列已满),则返回false;
接口方法 offer的具体实现,由各自的队列实现类实现
|
protected Node<E> |
peekNode()
返回队列头部的元素 ,如果队列为空,则返回null
接口方法 peek的具体实现,由各自的队列实现类实现
|
E |
poll(long timeout,
java.util.concurrent.TimeUnit unit)
移除并获取队首元素,若成功,则返回队首元素;队列无数据,阻塞等待
|
protected Node<E> |
pollNode()
移除并获取队首元素,若成功,则返回队首元素;否则返回null
接口方法 poll的具体实现,由各自的队列实现类实现
|
void |
put(E e)
存入元素,队列已满,阻塞等待
|
protected boolean |
removeAllNodes(java.util.Collection<?> c) |
protected boolean |
removeNode(Node<java.lang.Object> o) |
protected boolean |
retainAllNodes(java.util.Collection<?> c) |
int |
size() |
E |
take()
去数据,当队列为空时阻塞
|
add, addAll, contains, containsAll, element, iterator, offer, peek, poll, remove, remove, removeAll, retainAll, toArray, toArraypublic CTPBlockQueue()
public CTPBlockQueue(int capacity)
capacity - 阻塞队列的大小,默认为Integer.MAX_VALUEpublic int size()
public boolean isEmpty()
public void clear()
public boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
e - timeout - 超时时间unit - 单位java.lang.InterruptedExceptionprotected boolean offerNode(Node<E> node)
AbstractCTPQueueofferNode 在类中 AbstractCTPQueue<E>node - 封装了租户id和实际队列对象的对象public E poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
timeout - 超时时间unit - 单位java.lang.InterruptedExceptionpublic E take() throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void put(E e) throws java.lang.InterruptedException
e - java.lang.InterruptedExceptionprotected Node<E> pollNode()
AbstractCTPQueuepollNode 在类中 AbstractCTPQueue<E>protected Node<E> peekNode()
AbstractCTPQueuepeekNode 在类中 AbstractCTPQueue<E>protected java.util.Iterator<Node<E>> getIterator()
AbstractCTPQueuegetIterator 在类中 AbstractCTPQueue<E>protected boolean removeNode(Node<java.lang.Object> o)
removeNode 在类中 AbstractCTPQueue<E>protected boolean containsNode(Node<java.lang.Object> o)
containsNode 在类中 AbstractCTPQueue<E>protected boolean containsAllNodes(java.util.Collection<?> c)
containsAllNodes 在类中 AbstractCTPQueue<E>protected boolean removeAllNodes(java.util.Collection<?> c)
removeAllNodes 在类中 AbstractCTPQueue<E>protected boolean retainAllNodes(java.util.Collection<?> c)
retainAllNodes 在类中 AbstractCTPQueue<E>