你的位置:首页 > 软件开发 > Java > 第九章 LinkedBlockingQueue源码解析

第九章 LinkedBlockingQueue源码解析

发布时间:2016-01-16 19:00:09
1、对于LinkedBlockingQueue需要掌握以下几点创建入队(添加元素)出队(删除元素)2、创建Node节点内部类与LinkedBlockingQueue的一些属性 static class Node<E> { E item;//节点封装的数据 ...

1、对于LinkedBlockingQueue需要掌握以下几点

  • 创建
  • 入队(添加元素)
  • 出队(删除元素)

2、创建

Node节点内部类与LinkedBlockingQueue的一些属性

第九章 LinkedBlockingQueue源码解析第九章 LinkedBlockingQueue源码解析
  static class Node<E> {    E item;//节点封装的数据    /**     * One of:     * - the real successor Node     * - this Node, meaning the successor is head.next     * - null, meaning there is no successor (this is the last node)     */    Node<E> next;//下一个节点    Node(E x) { item = x; }  }  /** 指定链表容量 */  private final int capacity;  /** 当前的元素个数 */  private final AtomicInteger count = new AtomicInteger(0);  /** 链表头节点 */  private transient Node<E> head;  /** 链表尾节点 */  private transient Node<E> last;  /** 出队锁 */  private final ReentrantLock takeLock = new ReentrantLock();  /** 出队等待条件 */  private final Condition notEmpty = takeLock.newCondition();  /** 入队锁 */  private final ReentrantLock putLock = new ReentrantLock();  /** 入队等待条件 */  private final Condition notFull = putLock.newCondition();

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:第九章 LinkedBlockingQueue源码解析

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录