Java 中断程序一个事件处理程序暂停其他事件处理程序

Java 中断程序一个事件处理程序暂停其他事件处理程序,java,disruptor-pattern,lmax,Java,Disruptor Pattern,Lmax,我正在运行具有以下事件处理程序的disruptor实例: int NUM_EVENT_PROCESSORS = 5; executor = Executors.newFixedThreadPool(NUM_EVENT_PROCESSORS); EventFactory factory = new EventFactory(); System.out.println("Starting Disruptor"); disruptor = new Disruptor<>(facto

我正在运行具有以下事件处理程序的disruptor实例:

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();
int NUM\u事件处理器=5;
executor=Executors.newFixedThreadPool(NUM\u事件\u处理器);
EventFactory=neweventfactory();
System.out.println(“启动干扰器”);
disruptor=新的disruptor(工厂、环尺寸、执行器、ProducerType.SINGLE、新BlockingWaitStrategy());
handleEventsWith(新的Logger(),新的Replicator(),新的Logic());
disruptor.start();
我发现了一个实例,其中Replicator()线程挂起并阻塞了Logic()线程


如果ringbuffer中有1个事件,中断线程是否按顺序工作?

每个EventHandler都在独立于其他使用者线程的“使用者”线程中运行。其他使用者线程唯一会受到影响(减慢)的时间是当一个使用者的速度太慢,以至于RingBuffer变得满时,从而导致生产者被阻塞,这反过来会影响使用者。
这是我自己的错误。我运行了2组中断器(一个用于客户端,一个用于提供者端),我的客户端代码如下:

disruptor.handleEventsWith(new Logger(), new Replicator()).then(new Logic());
disruptor.handleEventsWith(new Logger(), new Replicator(), new Logic());
而我的提供者端代码如下所示:

disruptor.handleEventsWith(new Logger(), new Replicator()).then(new Logic());
disruptor.handleEventsWith(new Logger(), new Replicator(), new Logic());
因此,客户端的disruptor实例正在按照要求进行操作。如果复制器阻塞,逻辑线程也会阻塞


感谢stack overflow让我再次检查代码。

构造Disruptor实例时使用了什么排序执行器?@Sam Turtel Barker
int NUM_EVENT_PROCESSORS=5;executor=Executors.newFixedThreadPool(NUM\u事件\u处理器);EventFactory=neweventfactory();System.out.println(“启动干扰器”);disruptor=新的disruptor(工厂、环尺寸、执行器、ProducerType.SINGLE、新BlockingWaitStrategy())