干扰器的事件处理程序未正确设置

时间:2013-10-29 15:23:12

标签: java disruptor-pattern

我希望使用disruptor 2.10.4。 disruptor / ringbuffer是用户定义的类中的属性。出于某种原因,我觉得我的处理程序没有被调用

    final EventHandler<Message> handler = new EventHandler<Message>() { 
        public void onEvent(final UserDefinedMessage event, final long sequence, final boolean endOfBatch) throws Exception {
            log.info("Sequence: " + sequence);
            log.info("disruptor message: " + event.getValue());
        }
    };  

//    disruptor = new Disruptor<UserDefinedMessage>(UserDefinedMessage.EVENT_FACTORY, 1024, exec);  
      disruptor = new Disruptor<UserDefinedMessage>(UserDefinedMessage.EVENT_FACTORY, exec, new SingleThreadedClaimStrategy(50), new SleepingWaitStrategy());
    disruptor.handleEventsWith(handler); 
    ringBuffer = disruptor.start();

更新:导航错误 - 我不相信消息正在发布到环形缓冲区。

0 个答案:

没有答案