udp优化
This commit is contained in:
@@ -51,18 +51,20 @@ public class SncpClientCodecTest {
|
||||
ByteArray writeArray = new ByteArray();
|
||||
request.prepare(header, 1, "", new byte[20]);
|
||||
System.out.println("request.1 = " + request);
|
||||
writeArray.put(new byte[SncpHeader.HEADER_SIZE]);
|
||||
request.writeTo(conn, writeArray);
|
||||
request.prepare(header, 2, "", new byte[25]);
|
||||
System.out.println("request.2 = " + request);
|
||||
writeArray.put(new byte[SncpHeader.HEADER_SIZE]);
|
||||
request.writeTo(conn, writeArray);
|
||||
System.out.println(writeArray.getBytes().length);
|
||||
realBuf = ByteBuffer.wrap(writeArray.getBytes());
|
||||
}
|
||||
System.out.println("sncp.realBuf = " + realBuf.remaining());
|
||||
codec.decodeMessages(realBuf, new ByteArray());
|
||||
System.out.println("respResults.size = " + respResults.size());
|
||||
if (!main) {
|
||||
Assertions.assertEquals(2, respResults.size());
|
||||
}
|
||||
System.out.println(respResults);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SncpTest {
|
||||
|
||||
private static final String protocol = "SNCP.UDP";
|
||||
|
||||
private static final int clientCapacity = protocol.endsWith(".UDP") ? 1350 : 8192;
|
||||
private static final int clientCapacity = protocol.endsWith(".UDP") ? AsyncGroup.UDP_BUFFER_CAPACITY : 8192;
|
||||
|
||||
private static final ResourceFactory factory = ResourceFactory.create();
|
||||
|
||||
@@ -94,7 +94,8 @@ public class SncpTest {
|
||||
callbean = service.insert(callbean);
|
||||
System.out.println("bean: " + callbean);
|
||||
System.out.println("---------------------------------------------------");
|
||||
final int count = 10;
|
||||
Thread.sleep(200);
|
||||
final int count = 1;
|
||||
final CountDownLatch cld = new CountDownLatch(count);
|
||||
final AtomicInteger ai = new AtomicInteger();
|
||||
long s = System.currentTimeMillis();
|
||||
@@ -110,7 +111,7 @@ public class SncpTest {
|
||||
bean.setContent("数据: " + (k < 10 ? "0" : "") + k);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(k).append("------");
|
||||
for (int i = 0; i < 120; i++) {
|
||||
for (int i = 0; i < 900; i++) {
|
||||
sb.append("_").append(i).append("_").append(k).append("_0123456789");
|
||||
}
|
||||
bean.setContent(sb.toString());
|
||||
|
||||
@@ -65,7 +65,7 @@ public class SncpTestServiceImpl implements SncpTestIService {
|
||||
@Override
|
||||
public String queryResult(SncpTestBean bean) {
|
||||
System.out.println(Thread.currentThread().getName() + " 运行了queryResult方法");
|
||||
return "result: " + bean.getId();
|
||||
return "result: " + bean.getContent();
|
||||
}
|
||||
|
||||
public void queryResult(CompletionHandler<String, SncpTestBean> handler, @RpcAttachment SncpTestBean bean) {
|
||||
|
||||
Reference in New Issue
Block a user