Application.nodeid改为string类型
This commit is contained in:
@@ -53,7 +53,7 @@ public class CacheInstanceTest {
|
||||
CacheAsmMethodBoost boost = new CacheAsmMethodBoost(false, serviceClass);
|
||||
SncpRpcGroups grous = new SncpRpcGroups();
|
||||
AsyncGroup iGroup = AsyncGroup.create("", Utility.newScheduledExecutor(1), 0, 0);
|
||||
SncpClient client = new SncpClient("", iGroup, 0, new InetSocketAddress("127.0.0.1", 8080), new ClientAddress(), "TCP", 1, 16);
|
||||
SncpClient client = new SncpClient("", iGroup, "0", new InetSocketAddress("127.0.0.1", 8080), new ClientAddress(), "TCP", 1, 16);
|
||||
CacheInstance instance = Sncp.createLocalService(null, "", serviceClass, boost, resourceFactory,
|
||||
grous, client, null, null, null);
|
||||
//System.out.println(instance.getName());
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ABMainService implements Service {
|
||||
final AsyncIOGroup asyncGroup = new AsyncIOGroup(8192, 16);
|
||||
asyncGroup.start();
|
||||
InetSocketAddress sncpAddress = new InetSocketAddress("127.0.0.1", abport);
|
||||
final SncpClient client = new SncpClient("", asyncGroup, 0, sncpAddress, new ClientAddress(sncpAddress), "TCP", 16, 100);
|
||||
final SncpClient client = new SncpClient("", asyncGroup, "0", sncpAddress, new ClientAddress(sncpAddress), "TCP", 16, 100);
|
||||
final ResourceFactory resFactory = ResourceFactory.create();
|
||||
resFactory.register(JsonConvert.root());
|
||||
resFactory.register(BsonConvert.root());
|
||||
@@ -94,7 +94,7 @@ public class ABMainService implements Service {
|
||||
server.init(AnyValueWriter.create("port", abport));
|
||||
server.addRestServlet(null, service, null, HttpServlet.class, "/pipes");
|
||||
server.start();
|
||||
Thread.sleep(100);
|
||||
Utility.sleep(100);
|
||||
System.out.println("开始请求");
|
||||
|
||||
//不声明一个新的HttpClient会导致Utility.postHttpContent操作
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SncpClientCodecTest {
|
||||
InetSocketAddress sncpAddress = new InetSocketAddress("127.0.0.1", 3389);
|
||||
InetSocketAddress remoteAddress = new InetSocketAddress("127.0.0.1", 3344);
|
||||
final AsyncIOGroup asyncGroup = new AsyncIOGroup(8192, 16);
|
||||
SncpClient client = new SncpClient("test", asyncGroup, 0, sncpAddress, new ClientAddress(remoteAddress), "TCP", Utility.cpus(), 16);
|
||||
SncpClient client = new SncpClient("test", asyncGroup, "0", sncpAddress, new ClientAddress(remoteAddress), "TCP", Utility.cpus(), 16);
|
||||
SncpClientConnection conn = client.createClientConnection(asyncGroup.newTCPClientConnection());
|
||||
SncpClientCodec codec = new SncpClientCodec(conn);
|
||||
List respResults = new ArrayList();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SncpRequestParseTest {
|
||||
InetSocketAddress sncpAddress = new InetSocketAddress("127.0.0.1", 3389);
|
||||
InetSocketAddress remoteAddress = new InetSocketAddress("127.0.0.1", 3344);
|
||||
final AsyncIOGroup asyncGroup = new AsyncIOGroup(8192, 16);
|
||||
SncpClient client = new SncpClient("test", asyncGroup, 0, sncpAddress, new ClientAddress(remoteAddress), "TCP", Utility.cpus(), 16);
|
||||
SncpClient client = new SncpClient("test", asyncGroup, "0", sncpAddress, new ClientAddress(remoteAddress), "TCP", Utility.cpus(), 16);
|
||||
SncpClientConnection conn = client.createClientConnection(asyncGroup.newTCPClientConnection());
|
||||
|
||||
SncpContext.SncpContextConfig config = new SncpContext.SncpContextConfig();
|
||||
|
||||
@@ -52,7 +52,7 @@ public class SncpSleepTest {
|
||||
int port = server.getSocketAddress().getPort();
|
||||
System.out.println("SNCP服务器启动端口: " + port);
|
||||
InetSocketAddress sncpAddress = new InetSocketAddress("127.0.0.1", port);
|
||||
final SncpClient client = new SncpClient("", asyncGroup, 0, sncpAddress, new ClientAddress(sncpAddress), "TCP", 16, 100);
|
||||
final SncpClient client = new SncpClient("", asyncGroup, "0", sncpAddress, new ClientAddress(sncpAddress), "TCP", 16, 100);
|
||||
final SncpRpcGroups rpcGroups = application.getSncpRpcGroups();
|
||||
rpcGroups.computeIfAbsent("cs", "TCP").putAddress(sncpAddress);
|
||||
SncpSleepService remoteCService = Sncp.createSimpleRemoteService(SncpSleepService.class, resFactory, rpcGroups, client, "cs");
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SncpTest {
|
||||
asyncGroup.start();
|
||||
|
||||
InetSocketAddress sncpAddress = addr;
|
||||
final SncpClient client = new SncpClient("", asyncGroup, 0, sncpAddress, new ClientAddress(sncpAddress), protocol.endsWith(".UDP") ? "UDP" : "TCP", 16, 100);
|
||||
final SncpClient client = new SncpClient("", asyncGroup, "0", sncpAddress, new ClientAddress(sncpAddress), protocol.endsWith(".UDP") ? "UDP" : "TCP", 16, 100);
|
||||
|
||||
final SncpTestIService service = Sncp.createSimpleRemoteService(SncpTestIService.class, factory, rpcGroups, client, "client");//Sncp.createSimpleRemoteService(SncpTestIService.class, null, transFactory, addr, "client");
|
||||
factory.inject(service);
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.redkale.net.AsyncIOGroup;
|
||||
import org.redkale.net.client.ClientAddress;
|
||||
import org.redkale.net.sncp.*;
|
||||
import org.redkale.service.*;
|
||||
import org.redkale.util.Utility;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -31,7 +32,7 @@ public class SncpTestServiceImpl implements SncpTestIService {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
Utility.sleep(200);
|
||||
System.out.println(Thread.currentThread().getName() + " sleep 200ms后运行了异步方法-----------queryResultAsync方法");
|
||||
future.complete("异步 result: " + bean);
|
||||
} catch (Exception e) {
|
||||
@@ -93,7 +94,7 @@ public class SncpTestServiceImpl implements SncpTestIService {
|
||||
final SncpRpcGroups rpcGroups = application.getSncpRpcGroups();
|
||||
InetSocketAddress sncpAddress = new InetSocketAddress("127.0.0.1", 7070);
|
||||
rpcGroups.computeIfAbsent("g70", "TCP").putAddress(sncpAddress);
|
||||
final SncpClient client = new SncpClient("", asyncGroup, 0, sncpAddress, new ClientAddress(sncpAddress), "TCP", 16, 100);
|
||||
final SncpClient client = new SncpClient("", asyncGroup, "0", sncpAddress, new ClientAddress(sncpAddress), "TCP", 16, 100);
|
||||
|
||||
Service service = Sncp.createSimpleLocalService(SncpTestServiceImpl.class, factory);
|
||||
for (Method method : service.getClass().getDeclaredMethods()) {
|
||||
|
||||
Reference in New Issue
Block a user