摘要: AtomicInteger getAndSet方法 修改值并返回旧值 public final int getAndSet(int newValue) { return unsafe.getAndSetInt(this, valueOffset, newValue); //调用unsafe的方法 } 阅读全文
posted @ 2020-07-03 15:22 jesscia5 阅读(148) 评论(0) 推荐(0)
摘要: 可以通过ReentrantLock.newCondition()来获得Condition对象 public Condition newCondition() { return sync.newCondition(); //实际上是调用AQS的方法 } final ConditionObject ne 阅读全文
posted @ 2020-07-03 14:42 jesscia5 阅读(167) 评论(0) 推荐(0)
摘要: LinkedBlockingQueue public LinkedBlockingQueue() { this(Integer.MAX_VALUE); } public LinkedBlockingQueue(int capacity) { if (capacity <= 0) throw new 阅读全文
posted @ 2020-07-03 11:07 jesscia5 阅读(138) 评论(0) 推荐(0)