Пример #1
0
 public TestWaiter(CyclicBarrier cyclicBarrier,
     ISequenceBarrier sequenceBarrier,
     RingBuffer<StubEvent> ringBuffer,
     long initialSequence,
     long toWaitForSequence)
 {
     this.cyclicBarrier = cyclicBarrier;
     this.initialSequence = initialSequence;
     this.ringBuffer = ringBuffer;
     this.toWaitForSequence = toWaitForSequence;
     this.sequenceBarrier = sequenceBarrier;
 }
Пример #2
0
        private Future<List<StubEvent>> getMessages(long initial, long toWaitFor)
        {
            CyclicBarrier cyclicBarrier = new CyclicBarrier(2);
            ISequenceBarrier sequenceBarrier = ringBuffer.newBarrier();

            Future<List<StubEvent>> f = EXECUTOR.submit(new TestWaiter(cyclicBarrier, sequenceBarrier, ringBuffer, initial, toWaitFor));

            cyclicBarrier.await();

            return f;
        }