This commit is contained in:
Redkale
2017-06-03 18:41:08 +08:00
parent 10e22b0873
commit a6c105d63d
2 changed files with 10 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ package org.redkale.boot.watch;
import java.net.*;
import java.nio.channels.AsynchronousSocketChannel;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.redkale.boot.Application;
@@ -39,6 +40,11 @@ public class TransportWatchService implements WatchService {
@Resource
private TransportFactory transportFactory;
@RestMapping(name = "nodes", auth = false, comment = "获取所有Node节点")
public RetResult<List<TransportGroupInfo>> addNode() {
return new RetResult<>(transportFactory.getGroupInfos());
}
@RestMapping(name = "addnode", auth = false, comment = "动态增加指定Group的Node节点")
public RetResult addNode(
@RestParam(name = "group", comment = "Group节点名") final String group,

View File

@@ -141,6 +141,10 @@ public class TransportFactory {
return executor;
}
public List<TransportGroupInfo> getGroupInfos() {
return new ArrayList<>(this.groupInfos.values());
}
public void addSncpService(Service service) {
if (service == null) return;
services.add(new WeakReference<>(service));