code: @Override
      public boolean offer(T t, long timeout, TimeUnit unit) throws InterruptedException {
  
          if (t == null) {
              throw new IllegalArgumentException();
          }
  
          //TODO: Add expedited offer/fix waiting logic
  
          // D220640: Next two lines pulled out of synchronization block:
          long timeoutMS = unit.toMillis(timeout);
          long start = (timeoutMS <= 0) ? 0 : -1;
          long waitTime = timeoutMS;
  
          // D312598 - begin
          boolean ret = false;
          while (true) {
              synchronized (lock) {
                  if (numberOfUsedSlots.get() < buffer.length) {
                      insert(t);
                      numberOfUsedSlots.getAndIncrement();
                      ret = true;
                  }
              }
  
              if (ret) {
                  notifyGet_();
                  return true;
              }
  
              if (start == -1)
                  start = System.currentTimeMillis();
  
              int spinctr = SPINS_PUT_;
              while (numberOfUsedSlots.get() >= buffer.length) {
                  if (waitTime <= 0) {
                      return false;
                  }
                  // busy wait
                  if (spinctr > 0) {
                      if (YIELD_PUT_)
                          Thread.yield();
                      spinctr--;
                  } else {
                      // block on lock
                      waitPut_(waitTime);
                  }
                  waitTime = timeoutMS - (System.currentTimeMillis() - start);
              }
          }
          // D312598 - end
  
      }
docs: Puts an object into the buffer. If the buffer is full,
  the call will block for up to the specified amount of
  time, waiting for space to be freed up.
  
  @param x the object being placed into the buffer.
  @param timeout the maximum amount of time
  that the caller is willing to wait if the buffer is full.
  @return true if the object was added to the buffer; false if
  it was not added before the timeout expired.