mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
补充获取ZK的namespace的方法
This commit is contained in:
@@ -16,7 +16,7 @@ public class ZookeeperUtils {
|
||||
* 解析ZK地址
|
||||
* @see ConnectStringParser
|
||||
*/
|
||||
public static List<Tuple<String, Integer>> connectStringParser(String connectString) throws Exception {
|
||||
public static List<Tuple<String, Integer>> connectStringParser(String connectString) {
|
||||
List<Tuple<String, Integer>> 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user