【发布时间】:2015-07-30 13:06:51
【问题描述】:
我正在使用以下事件处理程序运行中断实例:
int NUM_EVENT_PROCESSORS = 5;
executor = Executors.newFixedThreadPool(NUM_EVENT_PROCESSORS);
EventFactory factory = new EventFactory();
System.out.println("Starting Disruptor");
disruptor = new Disruptor<>(factory, RING_SIZE, executor, ProducerType.SINGLE, new BlockingWaitStrategy());
disruptor.handleEventsWith(new Logger(), new Replicator(), new Logic());
disruptor.start();
我发现了一个实例,其中 Replicator() 线程挂起并阻塞了 Logic() 线程。
如果 ringbuffer 中有 1 个事件,中断线程是否按顺序工作?
【问题讨论】:
-
你在构建 Disruptor 实例时使用了什么样的执行器?
-
@Sam Turtel Barker
int NUM_EVENT_PROCESSORS = 5; executor = Executors.newFixedThreadPool(NUM_EVENT_PROCESSORS); EventFactory factory = new EventFactory(); System.out.println("Starting Disruptor"); disruptor = new Disruptor<>(factory, RING_SIZE, executor, ProducerType.SINGLE, new BlockingWaitStrategy());
标签: java disruptor-pattern lmax