private boolean doAcquireSharedNanos(long arg,long nanosTimeout) throws InterruptedException {
  if (nanosTimeout <= 0L)   return false;
  final long deadline=System.nanoTime() + nanosTimeout;
  final Node node=addWaiter(Node.SHARED);
  boolean failed=true;
  try {
    for (; ; ) {
      final Node p=node.predecessor();
      if (p == head) {
        long r=tryAcquireShared(arg);
        if (r >= 0) {
          setHeadAndPropagate(node,r);
          p.next=null;
          failed=false;
          return true;
        }
      }
      nanosTimeout=deadline - System.nanoTime();
      if (nanosTimeout <= 0L)       return false;
      if (shouldParkAfterFailedAcquire(p,node) && nanosTimeout > spinForTimeoutThreshold)       LockSupport.parkNanos(this,nanosTimeout);
      if (Thread.interrupted())       throw new InterruptedException();
    }
  }
  finally {
    if (failed)     cancelAcquire(node);
  }
}

private boolean doAcquireSharedNanos ( long arg , long nanosTimeout ) throws InterruptedException { if ( nanosTimeout <= 0L ) return false ; final long deadline = System . nanoTime ( ) + nanosTimeout ; final Node node = addWaiter ( Node . SHARED ) ; boolean failed = true ; try { for ( ; ; ) { final Node p = node . predecessor ( ) ; if ( p == head ) { long r = tryAcquireShared ( arg ) ; if ( r >= 0 ) { setHeadAndPropagate ( node , r ) ; p . next = null ; failed = false ; return true ; } } nanosTimeout = deadline - System . nanoTime ( ) ; if ( nanosTimeout <= 0L ) return false ; if ( shouldParkAfterFailedAcquire ( p , node ) && nanosTimeout > spinForTimeoutThreshold ) LockSupport . parkNanos ( this , nanosTimeout ) ; if ( Thread . interrupted ( ) ) throw new InterruptedException ( ) ; } } finally { if ( failed ) cancelAcquire ( node ) ; } }
acquires in shared timed mode .
