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