code: private void run(String key, ConcurrentLinkedQueue<Work> workQueue) {
          Work work = workQueue.poll();
          CompletableFuture<Void> future;
          try {
              future = processEvent(work.getEvent());
          } catch (Exception e) {
              future = Futures.failedFuture(e);
          }
  
          future.whenComplete((r, e) -> {
              if (e != null && toPostpone(work.getEvent(), work.getPickupTime(), e)) {
                  handleWorkPostpone(key, workQueue, work);
              } else {
                  if (e != null) {
                      work.getResult().completeExceptionally(e);
                  } else {
                      work.getResult().complete(r);
                  }
  
                  handleWorkComplete(key, workQueue, work);
              }
          });
      }
docs: Run method is called only if work queue is not empty. So we can safely do a workQueue.poll.
  WorkQueue.poll should only happen in the run method and no where else.
  
  @param key       key for which we want to process the next event
  @param workQueue work queue for the key