内部类 Node
1 2 3 4 5 6 7
| private static class Node<E> { volatile E item; volatile Node<E> next; }
|
初始化
1 2 3 4 5 6 7 8 9 10 11
| private transient volatile Node<E> head;
private transient volatile Node<E> tail;
public ConcurrentLinkedQueue() { head = tail = new Node<E>(null); }
|
put过程
可以参考下面的链接。
参考
JDK1.8源码分析之ConcurrentLinkedQueue(五)
gcc Unsafe
openjdk Unsafe