private Node addWaiter(Node mode){
  Node node=new Node(Thread.currentThread(),mode);
  Node pred=tail;
  if (pred != null) {
    node.prev=pred;
    if (compareAndSetTail(pred,node)) {
      pred.next=node;
      return node;
    }
  }
  enq(node);
  return node;
}

private Node addWaiter ( Node mode ) { Node node = new Node ( Thread . currentThread ( ) , mode ) ; Node pred = tail ; if ( pred != null ) { node . prev = pred ; if ( compareAndSetTail ( pred , node ) ) { pred . next = node ; return node ; } } enq ( node ) ; return node ; }
creates and enqueues node for current thread and given mode .
