Browse Source

Merge pull request #873 from lcybo/master

单核环境下创建线程池会出错。
agapple 6 years ago
parent
commit
899592ce2a

+ 2 - 2
parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlMultiStageCoprocessor.java

@@ -80,8 +80,8 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement
         this.disruptorMsgBuffer = RingBuffer.createSingleProducer(new MessageEventFactory(),
             ringBufferSize,
             new BlockingWaitStrategy());
-
-        this.parserExecutor = Executors.newFixedThreadPool(parserThreadCount,
+        int tc = parserThreadCount > 0 ? parserThreadCount : 1;
+        this.parserExecutor = Executors.newFixedThreadPool(tc,
             new NamedThreadFactory("MultiStageCoprocessor-Parser-" + destination));
 
         this.stageExecutor = Executors.newFixedThreadPool(2, new NamedThreadFactory("MultiStageCoprocessor-other-"