code: public synchronized Object get(final long timeout)
              throws InterruptedException {
          if (status == closed) {
              return null;
          }
  
          long currentTime = System.currentTimeMillis();
          final long stopTime = currentTime + timeout;
          Object o = null;
  
          while (true) {
              if ((o = tryGet()) != null) {
                  return o;
              }
  
              currentTime = System.currentTimeMillis();
              if (stopTime <= currentTime) {
                  throw new InterruptedException("Get operation timed out");
              }
  
              try {
                  this.wait(stopTime - currentTime);
              } catch (final InterruptedException e) {
                  // ignore, but really should retry operation instead
              }
          }
      }
docs: Retrieve an object from the head of the queue, blocking until one arrives
  or until timeout occurs.
  
  @param timeout
  Maximum time to block on queue, in ms. Use 0 to poll the
  queue.
  
  @exception InterruptedException
  if the operation times out.
  
  @return The object at the head of the queue, or null if none arrived in
  time.