@Override
  public T get() {
    Queue<T> itemBatch = readBatch;

    if (itemBatch == null || itemBatch.isEmpty()) {
      do {
        if (done && itemQueue.isEmpty()) {
          break;
        }

        if ((itemBatch = itemQueue.poll()) == null) {
          try {
            itemBatch = itemQueue.poll(100, TimeUnit.MILLISECONDS);
            if (itemBatch != null) {
              if (itemBatch == doneSentinel) {
                done = true;
              }
              break;
            }
          } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            break;// signal EOF
          }
        } else if (itemBatch == doneSentinel) {
          done = true;
        }
      } while (itemBatch == null);
      readBatch = itemBatch;
    }

    return itemBatch == null ? null : itemBatch.poll();
  }
Creates a new {@code WeightedHandoffQueue} with {@code outer} maximum number of pending batches and {@code inner}
maximum batch weight.
planetiler-core/src/main/java/com/onthegomap/planetiler/worker/WeightedHandoffQueue.java