yikf commented on pull request #3042:
URL: https://github.com/apache/hadoop/pull/3042#issuecomment-846029637


   For reviewer:
   
   ```
       public Reference<? extends T> remove(long timeout)
           throws IllegalArgumentException, InterruptedException
       {
           if (timeout < 0) {
               throw new IllegalArgumentException("Negative timeout value");
           }
           synchronized (lock) {
               Reference<? extends T> r = reallyPoll();
               if (r != null) return r;
               long start = (timeout == 0) ? 0 : System.nanoTime();
               for (;;) {
                   lock.wait(timeout);
                   r = reallyPoll();
                   if (r != null) return r;
                   if (timeout != 0) {
                       long end = System.nanoTime();
                       timeout -= (end - start) / 1000_000;
                       if (timeout <= 0) return null;
                       start = end;
                   }
               }
           }
       }
   
       /**
        * Removes the next reference object in this queue, blocking until one
        * becomes available.
        *
        * @return A reference object, blocking until one becomes available
        * @throws  InterruptedException  If the wait is interrupted
        */
       public Reference<? extends T> remove() throws InterruptedException {
           return remove(0);
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to