use of com.lmax.disruptor.support.LongEvent in project disruptor by LMAX-Exchange.
the class WaitForShutdown method main.
public static void main(String[] args) throws TimeoutException, InterruptedException {
Disruptor<LongEvent> disruptor = new Disruptor<LongEvent>(LongEvent.FACTORY, 16, DaemonThreadFactory.INSTANCE);
CountDownLatch shutdownLatch = new CountDownLatch(2);
disruptor.handleEventsWith(new Handler(shutdownLatch)).then(new Handler(shutdownLatch));
disruptor.start();
long next = disruptor.getRingBuffer().next();
disruptor.getRingBuffer().get(next).set(next);
disruptor.getRingBuffer().publish(next);
disruptor.shutdown(10, TimeUnit.SECONDS);
shutdownLatch.await();
System.out.println(value);
}
Aggregations