提交 af3117d1 编写于 作者: wu-sheng's avatar wu-sheng

修正包名称

上级 e3dab2c5
package com.a.eye.skywalking.registry.logging;
package com.a.eye.skywalking.registry;
import com.a.eye.skywalking.registry.logging.api.Center;
import com.a.eye.skywalking.registry.logging.api.RegistryCenter;
import com.a.eye.skywalking.registry.api.Center;
import com.a.eye.skywalking.registry.api.RegistryCenter;
import java.util.HashMap;
import java.util.Iterator;
......
package com.a.eye.skywalking.registry.logging.api;
package com.a.eye.skywalking.registry.api;
import java.lang.annotation.*;
......
package com.a.eye.skywalking.registry.logging.api;
package com.a.eye.skywalking.registry.api;
/**
* Created by wusheng on 2016/11/10.
......
package com.a.eye.skywalking.registry.logging.api;
package com.a.eye.skywalking.registry.api;
/**
* Created by xin on 2016/11/10.
......
package com.a.eye.skywalking.registry.logging.api;
package com.a.eye.skywalking.registry.api;
public interface NotifyListener {
void notify(EventType type, String urls);
......
package com.a.eye.skywalking.registry.logging.api;
package com.a.eye.skywalking.registry.api;
import java.util.Properties;
......@@ -9,16 +9,14 @@ public interface RegistryCenter {
/**
* 主要用于storage启动注册使用,将自身IP和端口注册到注册中心
* 格式为:
* /storage_list/192.168.0.1:3400 NULL
*
* @param path
*
* @param path 格式为:/storage_list/192.168.0.1:3400
*/
void register(String path);
/**
* 主要用于routing节点在启动完成之后,读取和监听stroage节点列表
* 格式
*
* @param path
* @param listener
......
package com.a.eye.skywalking.registry.logging.impl.zookeeper;
package com.a.eye.skywalking.registry.impl.zookeeper;
import com.a.eye.skywalking.logging.ILog;
import com.a.eye.skywalking.logging.LogManager;
......
package com.a.eye.skywalking.registry.logging.impl.zookeeper;
package com.a.eye.skywalking.registry.impl.zookeeper;
import com.a.eye.skywalking.logging.ILog;
import com.a.eye.skywalking.logging.LogManager;
import com.a.eye.skywalking.registry.logging.api.*;
import com.a.eye.skywalking.registry.api.*;
import org.apache.zookeeper.*;
import java.io.IOException;
......@@ -23,32 +23,32 @@ public class ZookeeperRegistryCenter implements RegistryCenter {
createPath = "/" + createPath;
}
recursionCreatePath(createPath, 0);
mkdirs(createPath, 0);
}
/**
* @param createPath
* @param path
* @param index
*/
private void recursionCreatePath(String createPath, int index) {
private void mkdirs(String path, int index) {
//TODO: 修改成循环创建
try {
int next = createPath.indexOf("/", index + 1);
String path = createPath;
int next = path.indexOf("/", index + 1);
CreateMode createMode = CreateMode.EPHEMERAL;
if (next != -1) {
createMode = CreateMode.PERSISTENT;
path = createPath.substring(0, next);
path = path.substring(0, next);
}
if (client.exists(path, false) == null)
client.create(path, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, createMode);
if (next != -1) {
recursionCreatePath(createPath, next);
mkdirs(path, next);
}
} catch (Exception e) {
logger.error("Failed to create path[{}]", createPath, e);
logger.error("Failed to create path[{}]", path, e);
}
}
......@@ -91,11 +91,11 @@ public class ZookeeperRegistryCenter implements RegistryCenter {
@Override
public void process(WatchedEvent event) {
retryWatch();
if (event.getType() == Event.EventType.NodeChildrenChanged) {
notifyListener(event);
}
retryWatch();
}
private void notifyListener(WatchedEvent event) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册