docs: private int sample(BlockingQueue<Runnable> queue) {
          ArrayList<Runnable> events = new ArrayList<Runnable>(queue);
          eventCount = events.size();
          if (eventCount < threshold) {
              return -1;
          }
  
          int sampleCount = min(samples, eventCount);
          int actualSampleCount = 0;
          while (actualSampleCount < sampleCount) {
              Runnable runnable = events.get(random.nextInt(eventCount));
              actualSampleCount += sampleRunnable(runnable);
          }
  
          return actualSampleCount;
      }