From 0f11a65df865ec5732733672d73ed163c4e8ba7b Mon Sep 17 00:00:00 2001 From: zengqiao Date: Sat, 29 Oct 2022 13:27:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=8E=B7=E5=8F=96ZK=E7=9A=84?= =?UTF-8?q?namespace=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../km/common/utils/zookeeper/ZookeeperUtils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/utils/zookeeper/ZookeeperUtils.java b/km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/utils/zookeeper/ZookeeperUtils.java index 9d8c6c5b..3ae38c34 100644 --- a/km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/utils/zookeeper/ZookeeperUtils.java +++ b/km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/utils/zookeeper/ZookeeperUtils.java @@ -16,7 +16,7 @@ public class ZookeeperUtils { * 解析ZK地址 * @see ConnectStringParser */ - public static List> connectStringParser(String connectString) throws Exception { + public static List> connectStringParser(String connectString) { List> ipPortList = new ArrayList<>(); if (connectString == null) { @@ -55,5 +55,14 @@ public class ZookeeperUtils { return ipPortList; } + public static String getNamespace(String zookeeperAddress) { + int index = zookeeperAddress.indexOf('/'); + String namespace = "/"; + if (index != -1) { + namespace = zookeeperAddress.substring(index); + } + return namespace; + } + }