mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-08 15:52:15 +08:00
补充获取ZK的namespace的方法
This commit is contained in:
@@ -16,7 +16,7 @@ public class ZookeeperUtils {
|
|||||||
* 解析ZK地址
|
* 解析ZK地址
|
||||||
* @see ConnectStringParser
|
* @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<>();
|
List<Tuple<String, Integer>> ipPortList = new ArrayList<>();
|
||||||
|
|
||||||
if (connectString == null) {
|
if (connectString == null) {
|
||||||
@@ -55,5 +55,14 @@ public class ZookeeperUtils {
|
|||||||
return ipPortList;
|
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