diff --git a/did-common/src/main/java/cn/ceres/did/common/Constants.java b/did-common/src/main/java/cn/ceres/did/common/Constants.java index 824e289..85c48d0 100644 --- a/did-common/src/main/java/cn/ceres/did/common/Constants.java +++ b/did-common/src/main/java/cn/ceres/did/common/Constants.java @@ -31,7 +31,7 @@ public class Constants { * 两个标识ID组合在分布式环境中必须唯一 */ public static long DATACENTER_ID = 1; - public static long MACHINES_SIGN = 1; + public static long MACHINES_ID = 1; /** * 流量控制,表示每秒处理的并发数 diff --git a/did-common/target/maven-archiver/pom.properties b/did-common/target/maven-archiver/pom.properties index ca70ec0..d96e7ae 100644 --- a/did-common/target/maven-archiver/pom.properties +++ b/did-common/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Tue Aug 14 15:16:52 CST 2018 +#Tue Aug 14 18:31:53 CST 2018 version=1.0-SNAPSHOT groupId=cn.ceres.did artifactId=did-common diff --git a/did-sdk/src/test/java/cn/ceres/did/DidSdkPressAsyncTest.java b/did-sdk/src/test/java/cn/ceres/did/DidSdkPressAsyncTest.java index e3801c4..5722181 100644 --- a/did-sdk/src/test/java/cn/ceres/did/DidSdkPressAsyncTest.java +++ b/did-sdk/src/test/java/cn/ceres/did/DidSdkPressAsyncTest.java @@ -9,7 +9,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; /** * 异步请求压测 @@ -23,7 +22,7 @@ public class DidSdkPressAsyncTest { @Test public void pressAsyncTest() throws Exception { - SdkClient client = new SdkClient(); + SdkClient client = new SdkClient("10.19.248.200",30581); client.init(); client.start(); @@ -46,15 +45,16 @@ public class DidSdkPressAsyncTest { }); } + // countDownLatch.await(10, TimeUnit.SECONDS); + countDownLatch.await(); end = System.currentTimeMillis(); cast = (end - start); allcast += cast; - countDownLatch.await(10, TimeUnit.SECONDS); logger.info("invokeAsync test num is: {}, cast time: {} millsec, throughput: {} send/millsec", NUM, cast, (double) NUM / cast); amount += NUM; - NUM = NUM + 5000; - TimeUnit.SECONDS.sleep(2); + // NUM = NUM + 5000; + // TimeUnit.SECONDS.sleep(2); } logger.info("invokeAsync test all num is: {}, all cast time: {} millsec, all throughput: {} send/millsec", amount, allcast, (double) amount / allcast); diff --git a/did-sdk/src/test/java/cn/ceres/did/DidSdkPressSyncTest.java b/did-sdk/src/test/java/cn/ceres/did/DidSdkPressSyncTest.java index 3ea844b..a107e32 100644 --- a/did-sdk/src/test/java/cn/ceres/did/DidSdkPressSyncTest.java +++ b/did-sdk/src/test/java/cn/ceres/did/DidSdkPressSyncTest.java @@ -6,8 +6,6 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.TimeUnit; - /** * 同步请求压测 * @@ -19,7 +17,7 @@ public class DidSdkPressSyncTest { @Test public void pressSyncTest() throws Exception { - SdkClient client = new SdkClient(); + SdkClient client = new SdkClient("10.19.248.200",30581); client.init(); client.start(); @@ -43,8 +41,8 @@ public class DidSdkPressSyncTest { logger.info("invokeSync test num is: {}, cast time: {} millsec, throughput: {} send/millsec", NUM, cast, (double) NUM / cast); amount += NUM; - NUM += 5000; - TimeUnit.SECONDS.sleep(2); + // NUM += 5000; + // TimeUnit.SECONDS.sleep(2); } logger.info("invokeSync test all num is: {}, all cast time: {} millsec, all throughput: {} send/millsec", amount, allcast, (double) amount / allcast); diff --git a/did-sdk/src/test/java/cn/ceres/did/DidSdkTest.java b/did-sdk/src/test/java/cn/ceres/did/DidSdkTest.java index e7db853..1cc9b27 100644 --- a/did-sdk/src/test/java/cn/ceres/did/DidSdkTest.java +++ b/did-sdk/src/test/java/cn/ceres/did/DidSdkTest.java @@ -13,11 +13,11 @@ import java.util.concurrent.TimeUnit; * @author ehlxr */ public class DidSdkTest { - private static final int NUM = 100; + private static final int NUM = 10; @Test public void didSdkTest() throws Exception { - SdkClient client = new SdkClient(); + SdkClient client = new SdkClient("10.19.248.200", 30581); client.init(); client.start(); diff --git a/did-sdk/target/maven-archiver/pom.properties b/did-sdk/target/maven-archiver/pom.properties index e16081b..74f933b 100644 --- a/did-sdk/target/maven-archiver/pom.properties +++ b/did-sdk/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Tue Aug 14 15:16:54 CST 2018 +#Tue Aug 14 18:31:54 CST 2018 version=1.0-SNAPSHOT groupId=cn.ceres.did artifactId=did-sdk diff --git a/did-server/dependency-reduced-pom.xml b/did-server/dependency-reduced-pom.xml index c1b9fc4..2922a2d 100644 --- a/did-server/dependency-reduced-pom.xml +++ b/did-server/dependency-reduced-pom.xml @@ -27,9 +27,6 @@ - - maven-source-plugin - diff --git a/did-server/pom.xml b/did-server/pom.xml index 38aee74..f55a0ce 100644 --- a/did-server/pom.xml +++ b/did-server/pom.xml @@ -42,10 +42,6 @@ - - org.apache.maven.plugins - maven-source-plugin - \ No newline at end of file diff --git a/did-server/src/main/java/cn/ceres/did/ServerStarter.java b/did-server/src/main/java/cn/ceres/did/ServerStarter.java index 7287a32..dd4399d 100644 --- a/did-server/src/main/java/cn/ceres/did/ServerStarter.java +++ b/did-server/src/main/java/cn/ceres/did/ServerStarter.java @@ -17,7 +17,7 @@ public class ServerStarter { public static void main(String[] args) { long datacenterId = Constants.DATACENTER_ID; - long machineId = Constants.MACHINES_SIGN; + long machineId = Constants.MACHINES_ID; if (args != null && args.length == 2) { datacenterId = Long.valueOf(args[0]); @@ -25,7 +25,7 @@ public class ServerStarter { } datacenterId = "".equals(Constants.getEnv("DATACENTER_ID")) ? datacenterId : Long.valueOf(Constants.getEnv("DATACENTER_ID")); - machineId = "".equals(Constants.getEnv("MACHINES_SIGN")) ? machineId : Long.valueOf(Constants.getEnv("MACHINES_SIGN")); + machineId = "".equals(Constants.getEnv("MACHINES_ID")) ? machineId : Long.valueOf(Constants.getEnv("MACHINES_ID")); logger.info("SnowFlake datacenterId is: {}, machineId is: {}", datacenterId, machineId); final SnowFlake snowFlake = new SnowFlake(datacenterId, machineId); diff --git a/did-server/src/main/java/cn/ceres/did/server/http/HttpServer.java b/did-server/src/main/java/cn/ceres/did/server/http/HttpServer.java index 707f4ba..123b8be 100644 --- a/did-server/src/main/java/cn/ceres/did/server/http/HttpServer.java +++ b/did-server/src/main/java/cn/ceres/did/server/http/HttpServer.java @@ -25,7 +25,7 @@ public class HttpServer extends BaseServer { public HttpServer(SnowFlake snowFlake) { this.snowFlake = snowFlake; - this.port = Constants.HTTP_PORT; + this.port = "".equals(Constants.getEnv("HTTP_PORT")) ? Constants.HTTP_PORT : Integer.valueOf(Constants.getEnv("HTTP_PORT")); } @Override diff --git a/did-server/src/main/java/cn/ceres/did/server/http/HttpServerHandler.java b/did-server/src/main/java/cn/ceres/did/server/http/HttpServerHandler.java index 80cce6f..0a74777 100644 --- a/did-server/src/main/java/cn/ceres/did/server/http/HttpServerHandler.java +++ b/did-server/src/main/java/cn/ceres/did/server/http/HttpServerHandler.java @@ -39,25 +39,25 @@ public class HttpServerHandler extends SimpleChannelInboundHandler