Skip to content

Commit e482328

Browse files
author
likongpeng
committed
修改注释
1 parent c929df9 commit e482328

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/main/java/java/util/concurrent/LinkedBlockingQueue.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ static class Node<E> {
159159
//take poll 时的锁
160160
private final ReentrantLock takeLock = new ReentrantLock();
161161

162-
// take的等待队列,condition 可以简单理解为基于ASQ同步机制建立的等待队列
162+
// take的条件队列,condition 可以简单理解为基于ASQ同步机制建立的条件队列
163163
private final Condition notEmpty = takeLock.newCondition();
164164

165165
// put offer 时的锁,设计两把锁的目的,主要为了 take 和 put 可以同时进行
166166
private final ReentrantLock putLock = new ReentrantLock();
167167

168-
// put的等待队列
168+
// put的条件队列
169169
private final Condition notFull = putLock.newCondition();
170170
// 锁 end
171171

@@ -295,14 +295,12 @@ private void enqueue(Node<E> node) {
295295
*/
296296
// 队头中取数据
297297
private E dequeue() {
298-
// assert takeLock.isHeldByCurrentThread();
299-
// assert head.item == null;
300298
Node<E> h = head;
301299
Node<E> first = h.next;
302300
h.next = h; // help GC
303301
head = first;
304302
E x = first.item;
305-
first.item = null;
303+
first.item = null;// 头节点指向 null,删除
306304
return x;
307305
}
308306

@@ -635,8 +633,7 @@ void unlink(Node<E> p, Node<E> trail) {
635633
/**
636634
* Removes a single instance of the specified element from this queue,
637635
* if it is present. More formally, removes an element {@code e} such
638-
* that {@code o.equals(e)}, if this queue contains one or more such
639-
* elements.
636+
* that {@code o.equals(e)}, if this queue contains one or more such elements.
640637
* Returns {@code true} if this queue contained the specified element
641638
* (or equivalently, if this queue changed as a result of the call).
642639
*

src/main/java/java/util/stream/Stream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
170170
Stream<T> filter(Predicate<? super T> predicate);
171171

172172
/**
173-
* Returns a stream consisting(组成) of the results of applying the given
174-
* function to the elements of this stream.
173+
* Returns a stream consisting of the results of applying the given
174+
function to the elements of this stream.
175175
*
176176
* <p>This is an <a href="package-summary.html#StreamOps">intermediate
177177
* operation</a>.

0 commit comments

Comments
 (0)