public static void main(String[] args) throws Exception {
int publisherNum = 50000;
Executor executor = Executors.newCachedThreadPool();
Disruptor
ValueEvent.EVENT_FACTORY, executor, new
MultiThreadedLowContentionClaimStrategy(4),new YieldingWaitStrategy() );
disruptor.handleEventsWith(new Customer());
RingBuffer
for (int i=0; i
ValueEvent event = ringBuffer.get(sequence);
executor.execute(new Publisher(ringBuffer, sequence));
}
}
其中Customer实现了EventHandler。在onEvent方法中只是打印输出,表示收到消息。
可是整个循环运行下来大概用了5分钟左右。
所以我对于Disruptor提到过的每秒6百万的处理能力不知道该如何去理解?还是说我这样的测试方法根本就有问题?
还请各位高手能够解释一下。谢谢大家!