From 0b055a3f554da3a934e79e88c4781705cbab5a21 Mon Sep 17 00:00:00 2001 From: renxue <auster_i@163.com> Date: 星期一, 24 十月 2022 11:40:26 +0800 Subject: [PATCH] 修改包下的类名 --- src/main/java/com/hz/canal/starter/factory/CanalConnectorFactory.java | 100 +++++++++++++++++++++++++------------------------- 1 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/main/java/com/duxinglangzi/canal/starter/factory/CanalConnectorFactory.java b/src/main/java/com/hz/canal/starter/factory/CanalConnectorFactory.java similarity index 93% rename from src/main/java/com/duxinglangzi/canal/starter/factory/CanalConnectorFactory.java rename to src/main/java/com/hz/canal/starter/factory/CanalConnectorFactory.java index 0ce17db..13c9b6f 100644 --- a/src/main/java/com/duxinglangzi/canal/starter/factory/CanalConnectorFactory.java +++ b/src/main/java/com/hz/canal/starter/factory/CanalConnectorFactory.java @@ -1,50 +1,50 @@ -package com.duxinglangzi.canal.starter.factory; - -import com.alibaba.otter.canal.client.CanalConnector; -import com.alibaba.otter.canal.client.CanalConnectors; -import com.alibaba.otter.canal.protocol.exception.CanalClientException; -import com.duxinglangzi.canal.starter.configuration.CanalAutoConfigurationProperties; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; - -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.util.ArrayList; -import java.util.List; - - -public class CanalConnectorFactory { - - /** - * 鍒涘缓 CanalConnector - * - * @param destination - * @param endpointInstance - * @return CanalConnector - * @author wuqiong 2022-04-23 20:36 - */ - public static synchronized CanalConnector createConnector( - String destination, CanalAutoConfigurationProperties.EndpointInstance endpointInstance) { - Assert.isTrue(StringUtils.hasText(destination), "destination is null , please check "); - Assert.isTrue(endpointInstance != null, "endpoint instance is null , please check "); - CanalConnector connector; - if (endpointInstance.isClusterEnabled()) { - if (!StringUtils.hasText(endpointInstance.getZookeeperAddress())) - throw new CanalClientException("zookeeper address is null"); - List<SocketAddress> addresses = new ArrayList<>(); - for (String s : endpointInstance.getZookeeperAddress().split(",")) { - String[] split = s.split(":"); - if (split.length != 2) - throw new CanalClientException("error parsing zookeeper address:" + s); - addresses.add(new InetSocketAddress(split[0], Integer.parseInt(split[1]))); - } - connector = CanalConnectors.newClusterConnector( - addresses, destination, endpointInstance.getUserName(), endpointInstance.getPassword()); - } else { - connector = CanalConnectors.newSingleConnector( - new InetSocketAddress(endpointInstance.getHost(), endpointInstance.getPort()), - destination, endpointInstance.getUserName(), endpointInstance.getPassword()); - } - return connector; - } -} +package com.hz.canal.starter.factory; + +import com.alibaba.otter.canal.client.CanalConnector; +import com.alibaba.otter.canal.client.CanalConnectors; +import com.alibaba.otter.canal.protocol.exception.CanalClientException; +import com.hz.canal.starter.configuration.CanalAutoConfigurationProperties; +import org.springframework.util.Assert; +import org.springframework.util.StringUtils; + +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.util.ArrayList; +import java.util.List; + + +public class CanalConnectorFactory { + + /** + * 鍒涘缓 CanalConnector + * + * @param destination + * @param endpointInstance + * @return CanalConnector + * @author wuqiong 2022-04-23 20:36 + */ + public static synchronized CanalConnector createConnector( + String destination, CanalAutoConfigurationProperties.EndpointInstance endpointInstance) { + Assert.isTrue(StringUtils.hasText(destination), "destination is null , please check "); + Assert.isTrue(endpointInstance != null, "endpoint instance is null , please check "); + CanalConnector connector; + if (endpointInstance.isClusterEnabled()) { + if (!StringUtils.hasText(endpointInstance.getZookeeperAddress())) + throw new CanalClientException("zookeeper address is null"); + List<SocketAddress> addresses = new ArrayList<>(); + for (String s : endpointInstance.getZookeeperAddress().split(",")) { + String[] split = s.split(":"); + if (split.length != 2) + throw new CanalClientException("error parsing zookeeper address:" + s); + addresses.add(new InetSocketAddress(split[0], Integer.parseInt(split[1]))); + } + connector = CanalConnectors.newClusterConnector( + addresses, destination, endpointInstance.getUserName(), endpointInstance.getPassword()); + } else { + connector = CanalConnectors.newSingleConnector( + new InetSocketAddress(endpointInstance.getHost(), endpointInstance.getPort()), + destination, endpointInstance.getUserName(), endpointInstance.getPassword()); + } + return connector; + } +} -- Gitblit v1.8.0