Skip to content

Commit

Permalink
重构代码
Browse files Browse the repository at this point in the history
  • Loading branch information
黄志磊 committed Jan 17, 2016
1 parent 03d36b1 commit e5e8dcb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
Expand Up @@ -16,7 +16,6 @@
import com.shinemo.mpush.tools.GenericsUtil;
import com.shinemo.mpush.tools.Jsons;
import com.shinemo.mpush.tools.spi.ServiceContainer;
import com.shinemo.mpush.tools.zk.ZKPath;
import com.shinemo.mpush.tools.zk.ZkRegister;
import com.shinemo.mpush.tools.zk.listener.DataChangeListener;

Expand Down Expand Up @@ -57,13 +56,15 @@ public void initData() {

public abstract String getRegisterPath();

public abstract String getFullPath(String raw);

public abstract ServerManage<T> getServerManage();

private void _initData() {
// 获取机器列表
List<String> rawData = zkRegister.getChildrenKeys(getRegisterPath());
for (String raw : rawData) {
String fullPath = ZKPath.CONNECTION_SERVER.getFullPath(raw);
String fullPath = getFullPath(raw);
T app = getServerApplication(fullPath,clazz);
getServerManage().addOrUpdate(fullPath, app);
}
Expand Down
Expand Up @@ -31,6 +31,11 @@ public String getRegisterPath() {
return ZKPath.GATEWAY_SERVER.getPath();
}

@Override
public String getFullPath(String raw) {
return ZKPath.GATEWAY_SERVER.getFullPath(raw);
}



}
Expand Up @@ -31,4 +31,9 @@ public ServerManage<ConnectionServerApplication> getServerManage() {
return connectionServerManage;
}

@Override
public String getFullPath(String raw) {
return ZKPath.CONNECTION_SERVER.getFullPath(raw);
}

}
@@ -1,22 +1,15 @@
package com.shinemo.mpush.ps;

import com.shinemo.mpush.api.PushSender;
import org.junit.Test;

import java.util.Arrays;
import java.util.concurrent.locks.LockSupport;


/**
* Created by ohun on 2016/1/7.
*/
public class PushTest {

@Test
public void testSend() throws Exception {

}

public static void main(String[] args) throws Exception {
GatewayClientMain client = new GatewayClientMain();
client.start();
Expand Down

0 comments on commit e5e8dcb

Please sign in to comment.