Returns Queue as iterator. Calls poll method. When timeout throws
NoSuchElementException which will remove it from merger.
@param <T>
@param queue
@param time
@param unit
@return
160334
public static <T> Iterator<T> iterator(BlockingQueue<T> queue, long time, TimeUnit unit)
    {
        return new XIteratorImpl<>(()->true, ()->
        {
            try
            {
                T item = queue.poll(time, unit);
                if (item == null)
                {
                    throw new NoSuchElementException("timeout");
                }
                return item;
            }
            catch (InterruptedException ex)
            {
                throw new NoSuchElementException("interrupted");
            }
        });
    }
412300
@Override
    public V poll(long timeout, TimeUnit unit) throws InterruptedException {
        return blockingQueue.poll(timeout, unit);
    }
461491
@Override
	public E poll(long timeout, TimeUnit unit) throws InterruptedException {
		E e = queue.poll(timeout, unit);
		if (e != null){
			signalSizeReduced();
		}
		return e;
	}
996082
@Override
  public <T> T run(long timeout, TimeUnit unit,
                   Consumer<Result<T>> task)
  {
    try (OutboxAmp outbox = OutboxAmp.currentOrCreate(this)) {
      ResultFuture<T> future = new ResultFuture<>();
      
      task.accept(future);
      
      return future.get(timeout, unit);
    }
  }
577374
public Activation dequeue() throws NoSuchElementException {
        if ( isEmpty() ) {
            return null;
        }

        final Activation result = this.elements[1];
        dequeue(result.getQueueIndex());

        return result;
    }
579152
@Override
    public final T poll(final long timeout, final TimeUnit unit) throws InterruptedException {
        final long start = getWriteLockWithOptionalWait(timeout, unit);
        if (start == Long.MIN_VALUE) {
            // Min value signals a timeout while waiting
            return null;
        }
        final long maxWait = start >= 0 ? unit.toMillis(timeout) : -1;

        try {
            // Wait for an element to be available to return
            if (!this.waitForAdd(start, maxWait)) {
                return null;
            }

            return this.pollInternal(false);
        } finally {
            this.writeLock.unlock();
        }
    }
1336009
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit) {
        return requestTimeout(delay, unit, null, null);
    }
712665
@Override
    public java.util.concurrent.Future<CreateQueueResult> createQueueAsync(String queueName) {

        return createQueueAsync(new CreateQueueRequest().withQueueName(queueName));
    }
856539
private Map<String, T> internalGet(long to, TimeUnit unit,
      Collection<Operation> timedoutOps) throws InterruptedException,
      ExecutionException {
    if (!latch.await(to, unit)) {
      for (Operation op : ops) {
        if (op.getState() != OperationState.COMPLETE) {
          MemcachedConnection.opTimedOut(op);
          timedoutOps.add(op);
        } else {
          MemcachedConnection.opSucceeded(op);
        }
      }
    }
    for (Operation op : ops) {
      if (op.isCancelled()) {
        throw new ExecutionException(new CancellationException("Cancelled"));
      }
      if (op.hasErrored()) {
        throw new ExecutionException(op.getException());
      }
    }
    Map<String, T> m = new HashMap<String, T>();
    for (Map.Entry<String, Future<T>> me : rvMap.entrySet()) {
      m.put(me.getKey(), me.getValue().get());
    }
    return m;
  }
988013
public ConverterServerBuilder requestTimeout(long timeout, TimeUnit unit) {
        assertNumericArgument(timeout, true);
        this.requestTimeout = unit.toMillis(timeout);
        return this;
    }
1355028
public long getTimeSpentInQueue() {
        lock.readLock().lock();
        try {
            return startTime - workUnit.context.item.buildableStartMilliseconds;
        } finally {
            lock.readLock().unlock();
        }
    }
1134402
protected Lock tryLockForWrite(long time, TimeUnit unit) throws InterruptedException {
        if (time < 0 || unit == null) {
            return tryLockForWrite();
        }
        Lock lock = writeLock();
        return lock.tryLock(time, unit) ? lock : null;
    }
866942
@SuppressWarnings("unchecked")
  public T queue(String name, Queue<?> queue) {
    for (Element e : elements()) {
      replacequeue(e, name, queue);
    }
    return (T) this;
  }
344385
public Map<String, T> getSome(long to, TimeUnit unit)
    throws InterruptedException, ExecutionException {
    Collection<Operation> timedoutOps = new HashSet<Operation>();
    Map<String, T> ret = internalGet(to, unit, timedoutOps);
    if (timedoutOps.size() > 0) {
      timeout = true;
      LoggerFactory.getLogger(getClass()).warn(
          new CheckedOperationTimeoutException("Operation timed out: ",
              timedoutOps).getMessage());
    }
    return ret;

  }
919434
@Override
    public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
        V v = super.get(timeout, unit);
        this.mergeWorkerTracyTheadContext();
        return v;
    }
743688
@Override
    public Queue getQueue() throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getQueue");
        Queue q = (Queue) theDestination;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getQueue", q);
        return q;
    }
781494
function(time) {
          if (this._queue.length === 0) return
          var i = 0, line, oldLines
          while ((line = this._queue[i++]) && time >= line.t2) 1
          oldLines = this._queue.slice(0, i - 1)
          this._queue = this._queue.slice(i - 1)
          if (this._queue.length === 0)
            this._lastValue = oldLines[oldLines.length - 1].v2
        }