瀏覽代碼

always check whether ringbuffer has an exception in event processor (#2053)

soocold 5 年之前
父節點
當前提交
066743cfd6

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

@@ -190,17 +190,17 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement
             return false;
         }
 
-        /**
-         * 由于改为processor仅终止自身stage而不是stop,那么需要由incident标识coprocessor是否正常工作。
-         * 让dump线程能够及时感知
-         */
-        if (exception != null) {
-            throw exception;
-        }
         boolean interupted = false;
         long blockingStart = 0L;
         int fullTimes = 0;
         do {
+            /**
+             * 由于改为processor仅终止自身stage而不是stop,那么需要由incident标识coprocessor是否正常工作。
+             * 让dump线程能够及时感知
+             */
+            if (exception != null) {
+                throw exception;
+            }
             try {
                 long next = disruptorMsgBuffer.tryNext();
                 MessageEvent data = disruptorMsgBuffer.get(next);