public interface BlockingQueue<E> extends Queue<E> {
/* 插入一个元素到对列中,如果成功则返回true 如果失败则抛出 IllegalStateException异常,如果队列有大小限制的话,通常倾向于使用offer方法
boolean add(E e);
//插入元素到对列,如果成功返回true,如果失败则返回false(空间不足)
//方法总是立即返回
boolean offer(E e);
//若无可用空间则阻塞,是offer的永久阻塞版本
void put(E e) throws InterruptedException;
//插入元素到队列,如果无法立即插入则最多等待指定的时间,如果插入成功返回true,否则返回false
boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException;
//取得并删除队列的头元素,若对列为空则阻塞直到队列内有元素
E take() throws InterruptedException;
//取得并返回队列的头元素,若队列为空则最多等待指定的时间,如果成功返回队列头,否则返回false
E poll(long timeout, TimeUnit unit)
throws InterruptedException;
//返回队列的剩余空间,无阻塞
int remainingCapacity();
//若用 o.equals(e) 判断队列中有存在相同的元素,则删除元素。若队列中存在多个相等的相同也只删除一个元素,并返回true,若未发现相等元素则返回false
boolean remove(Object o);
//若队列中至少含有一个 等于 o的元素则返回真,否则返回false
public boolean contains(Object o);
int drainTo(Collection<? super E> c);
int drainTo(Collection<? super E> c, int maxElements);
}
转载请注明出处:http://blog.csdn.net/congqingbin/article/details/28864877