diff --git a/bin/run.bat b/bin/run.bat index bf1e123..21d188e 100644 --- a/bin/run.bat +++ b/bin/run.bat @@ -1,5 +1,5 @@ @echo off && @chcp 65001 > nul pushd %~dp0 set LIB_DIR=%~dp0 -for /f "delims=X" %%i in ('dir /b %LIB_DIR%\web-*.jar') do set LAUNCH_JAR=%LIB_DIR%\%%i -"%JAVA_HOME%\bin\java.exe" -Xmx512M -Dfile.encoding=utf8 -jar %LAUNCH_JAR% %* \ No newline at end of file +for /f "delims=X" %%i in ('dir /b %LIB_DIR%\lz-cow-api-web-*.jar') do set LAUNCH_JAR=%LIB_DIR%\%%i +"%JAVA_HOME%\bin\java.exe" -Xmx512M -Dfile.encoding=utf8 -jar %LAUNCH_JAR% %* diff --git a/bin/run.sh b/bin/run.sh index 3d3f13c..45f81b8 100644 --- a/bin/run.sh +++ b/bin/run.sh @@ -1,5 +1,5 @@ #!/bin/sh # set -x -LAUNCH_JAR="web-*.jar" +LAUNCH_JAR="lz-cow-api-web-*.jar" nohup java -Xmx512M -jar "$LAUNCH_JAR" "$@" >startup.log 2>&1 & -tail -f startup.log \ No newline at end of file +tail -f startup.log diff --git a/core/src/main/java/cn/qaiu/vx/core/Deploy.java b/core/src/main/java/cn/qaiu/vx/core/Deploy.java index aae1198..e152e66 100644 --- a/core/src/main/java/cn/qaiu/vx/core/Deploy.java +++ b/core/src/main/java/cn/qaiu/vx/core/Deploy.java @@ -3,12 +3,11 @@ package cn.qaiu.vx.core; import cn.qaiu.vx.core.util.ConfigUtil; import cn.qaiu.vx.core.util.VertxHolder; import cn.qaiu.vx.core.verticle.ReverseProxyVerticle; -import cn.qaiu.vx.core.verticle.ServiceVerticle; import cn.qaiu.vx.core.verticle.RouterVerticle; +import cn.qaiu.vx.core.verticle.ServiceVerticle; import io.vertx.core.*; import io.vertx.core.json.JsonObject; import io.vertx.core.shareddata.LocalMap; -import io.vertx.core.shareddata.SharedData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,7 +52,7 @@ public final class Deploy { private void readConf(JsonObject conf) { outLogo(conf); - String activeMode = conf.getString("active"); + var activeMode = conf.getString("active"); if ("dev".equals(activeMode)) { LOGGER.info("---------------> development environment <--------------\n"); System.setProperty("vertxweb.environment","dev"); @@ -67,7 +66,7 @@ public final class Deploy { * 打印logo */ private void outLogo(JsonObject conf) { - Calendar calendar = Calendar.getInstance(); + var calendar = Calendar.getInstance(); calendar.setTime(new Date()); var year = calendar.get(Calendar.YEAR); var logoTemplete = """ @@ -101,20 +100,20 @@ public final class Deploy { LOGGER.info("配置读取成功"); customConfig = globalConfig.getJsonObject("custom"); - VertxOptions vertxOptions = new VertxOptions(globalConfig.getJsonObject("vertx")); - Vertx vertx = Vertx.vertx(vertxOptions); + var vertxOptions = new VertxOptions(globalConfig.getJsonObject("vertx")); + var vertx = Vertx.vertx(vertxOptions); VertxHolder.init(vertx); //配置保存在共享数据中 - SharedData sharedData = vertx.sharedData(); + var sharedData = vertx.sharedData(); LocalMap localMap = sharedData.getLocalMap("local"); localMap.put("globalConfig", globalConfig); localMap.put("customConfig", customConfig); localMap.put("server", globalConfig.getJsonObject("server")); handle.handle(globalConfig); - Future future1 = vertx.deployVerticle(RouterVerticle.class, getWorkDeploymentOptions("Router")); - Future future2 = vertx.deployVerticle(ServiceVerticle.class, getWorkDeploymentOptions("Service")); - Future future3 = vertx.deployVerticle(ReverseProxyVerticle.class, getWorkDeploymentOptions("proxy")); + var future1 = vertx.deployVerticle(RouterVerticle.class, getWorkDeploymentOptions("Router")); + var future2 = vertx.deployVerticle(ServiceVerticle.class, getWorkDeploymentOptions("Service")); + var future3 = vertx.deployVerticle(ReverseProxyVerticle.class, getWorkDeploymentOptions("proxy")); CompositeFuture.all(future1, future2, future3) .onSuccess(this::deployWorkVerticalSuccess) @@ -137,8 +136,8 @@ public final class Deploy { * @param compositeFuture future wraps a list */ private void deployWorkVerticalSuccess(CompositeFuture compositeFuture) { - double t1 = ((double) (System.currentTimeMillis() - startTime)) / 1000; - double t2 = ((double) System.currentTimeMillis() - ManagementFactory.getRuntimeMXBean().getStartTime()) / 1000; + var t1 = ((double) (System.currentTimeMillis() - startTime)) / 1000; + var t2 = ((double) System.currentTimeMillis() - ManagementFactory.getRuntimeMXBean().getStartTime()) / 1000; LOGGER.info("web服务启动成功 -> 用时: {}s, jvm启动用时: {}s", t1, t2); }