From 92920274207200239e3bcee629a469e2685eebdd Mon Sep 17 00:00:00 2001
From: duxinglangzi <871364441@qq.com>
Date: 星期一, 25 四月 2022 12:52:51 +0800
Subject: [PATCH] 增加关闭

---
 src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java    |    7 ++++++-
 src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java |    2 ++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java b/src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java
index bd0e919..a72b664 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java
@@ -22,6 +22,7 @@
 
     protected abstract void doStart();
     protected abstract void initConnect();
+    protected abstract void disconnect();
 
 
     @Override
@@ -32,6 +33,7 @@
                 sleep(5L * SLEEP_TIME_MILLI_SECONDS);
             initConnect();
             while (isRunning() && !Thread.currentThread().isInterrupted()) doStart();
+            disconnect(); // 绾跨▼琚粓姝㈡垨鑰呭鍣ㄥ凡缁忓仠姝�
         }).start();
         setRunning(true);
     }
diff --git a/src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java b/src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java
index ff89712..b9ed1b3 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java
@@ -35,6 +35,11 @@
 
     }
 
+    public void disconnect(){
+        // 鍏抽棴杩炴帴
+        connector.disconnect();
+    }
+
 
     public void doStart() {
         Message message = null;
@@ -48,7 +53,7 @@
                                 "thread interrupt , current connector host: {} , port: {} ",
                         endpointInstance.getHost(), endpointInstance.getPort());
                 Thread.currentThread().interrupt();
-                connector.disconnect();
+                disconnect();
             } else {
                 sleep(endpointInstance.getAcquireInterval());
             }

--
Gitblit v1.8.0