private void fillRingBuffer(long expectedNumberMessages) throws InterruptedException {
   for (long i = 0; i < expectedNumberMessages; i++) {
     long sequence = ringBuffer.next();
     StubEvent event = ringBuffer.getPreallocated(sequence);
     event.setValue((int) i);
     ringBuffer.publish(sequence);
   }
 }
  @Override
  protected long runDisruptorPass() throws InterruptedException {

    resetCounters();
    RingBuffer<ValueEvent> ringBuffer = workerPool.start(EXECUTOR);
    long start = System.currentTimeMillis();

    for (long i = 0; i < ITERATIONS; i++) {
      long sequence = ringBuffer.next();
      ringBuffer.getPreallocated(sequence).setValue(i);
      ringBuffer.publish(sequence);
    }

    workerPool.drainAndHalt();
    long opsPerSecond = (ITERATIONS * 1000L) / (System.currentTimeMillis() - start);

    assertEquals(ITERATIONS, sumCounters());

    return opsPerSecond;
  }