更改队列等待方式
This commit is contained in:
parent
c10ace2109
commit
d3aa06da36
@ -26,6 +26,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.lmax.disruptor.BlockingWaitStrategy;
|
||||
import com.lmax.disruptor.RingBuffer;
|
||||
import com.lmax.disruptor.YieldingWaitStrategy;
|
||||
import com.lmax.disruptor.dsl.Disruptor;
|
||||
@ -95,7 +96,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
||||
//初始化高性能队列
|
||||
int cpu = Runtime.getRuntime().availableProcessors();
|
||||
int bufferSize = 1024 * 4;
|
||||
disruptor = new Disruptor<>(TerminalMessage::new, bufferSize, DaemonThreadFactory.INSTANCE, ProducerType.MULTI, new YieldingWaitStrategy());
|
||||
disruptor = new Disruptor<>(TerminalMessage::new, bufferSize, DaemonThreadFactory.INSTANCE, ProducerType.MULTI, new BlockingWaitStrategy());
|
||||
//
|
||||
TerminalMessageWorkerHandler[] workerHandlers = new TerminalMessageWorkerHandler[cpu];
|
||||
for (int i = 0; i < cpu; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user