private void unparkSuccessor(Node node) {
int ws = node.waitStatus;//获得head节点的状态
if (ws < 0)
compareAndSetWaitStatus(node, ws, 0);//
设置head节点
状态为0
Node s = node.next;//得到head节点的下一个节点
if (s == null || s.waitStatus > 0) { //如果下一个节点为null或者status>0表示cancelled状态.
//通过从尾部节点开始扫描,找到距离head最近的一个
waitStatus<=0的节点
s = null;
for (Node t = tail; t != null && t != node; t = t.prev)
if (t.waitStatus <= 0)
s = t;
}
if (s != null) //next节点不为空,直接唤醒这个线程即可
LockSupport.unpark(s.thread);
}