@Override
      public void accept(T t) {
        if (finished) {
          throw new IllegalStateException("Finished");
        }
        if (done.get() == 0 || !pending.offer(t)) {
          consumer.accept(t);
        }
      }
A handle for each worker thread to offer new items, and drain the remaining ones when done.
planetiler-core/src/main/java/com/onthegomap/planetiler/worker/Distributor.java