duxinglangzi
2022-04-25 92920274207200239e3bcee629a469e2685eebdd
增加关闭
2个文件已修改
9 ■■■■ 已修改文件
src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
    }
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());
            }