修正包名称
This commit is contained in:
parent
e3dab2c57d
commit
af3117d1c6
|
|
@ -1,7 +1,7 @@
|
|||
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;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.a.eye.skywalking.registry.logging.api;
|
||||
package com.a.eye.skywalking.registry.api;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.a.eye.skywalking.registry.logging.api;
|
||||
package com.a.eye.skywalking.registry.api;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 2016/11/10.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.a.eye.skywalking.registry.logging.api;
|
||||
package com.a.eye.skywalking.registry.api;
|
||||
|
||||
/**
|
||||
* Created by xin on 2016/11/10.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.a.eye.skywalking.registry.logging.api;
|
||||
package com.a.eye.skywalking.registry.api;
|
||||
|
||||
public interface NotifyListener {
|
||||
void notify(EventType type, String urls);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
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;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
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) {
|
||||
|
|
@ -0,0 +1 @@
|
|||
com.a.eye.skywalking.registry.impl.zookeeper.ZookeeperRegistryCenter
|
||||
|
|
@ -1 +0,0 @@
|
|||
com.a.eye.skywalking.registry.logging.impl.zookeeper.ZookeeperRegistryCenter
|
||||
Loading…
Reference in New Issue