jdk11兼容

This commit is contained in:
QAIU
2024-06-19 09:51:08 +08:00
parent 966417f867
commit 9ded137539
20 changed files with 1312 additions and 224 deletions

View File

@@ -87,19 +87,15 @@ public final class Deploy {
var calendar = Calendar.getInstance();
calendar.setTime(new Date());
var year = calendar.get(Calendar.YEAR);
var logoTemplate = """
Web Server powered by:\s
____ ____ _ _ _ \s
|_^^_| |_^^_| / |_ | | | | \s
\\ \\ / /.---. _ .--.`| |-' _ __ | |__| |_ \s
\\ \\ / // /__\\\\[ `/'`\\]| | [ \\ [ ]|____ _|\s
\\ V / | \\__., | | | |, _ > ' < _| |_ \s
\\_/ '.__.'[___] \\__/(_)[__]`\\_] |_____|\s
Version: %s; Framework version: %s; %s©%d.
""";
String logoTemplate = "Web Server powered by: \n" +
" ____ ____ _ _ _ \n" +
"|_^^_| |_^^_| / |_ | | | | \n" +
" \\ \\ / /.---. _ .--.`| |-' _ __ | |__| |_ \n" +
" \\ \\ / // /__\\\\[ `/'`\\]| | [ \\ [ ]|____ _|\n" +
" \\ V / | \\__., | | | |, _ > ' < _| |_ \n" +
" \\_/ '.__.'[___] \\__/(_)[__]`\\_] |_____|\n" +
" Version: %s; Framework version: %s; JDK11; %s©%d.\n\n";
System.out.printf(logoTemplate,
conf.getString("version_app"),
VersionCommand.getVersion(),
@@ -132,9 +128,10 @@ public final class Deploy {
localMap.put(GLOBAL_CONFIG, globalConfig);
localMap.put(CUSTOM_CONFIG, customConfig);
localMap.put(SERVER, globalConfig.getJsonObject(SERVER));
var future0 = vertx.createSharedWorkerExecutor("other-handle").executeBlocking(bch -> {
var future0 = vertx.createSharedWorkerExecutor("other-handle").executeBlocking(() -> {
handle.handle(globalConfig);
bch.complete("other handle complete");
LOGGER.info("other handle complete");
return null;
});
// 部署 路由、异步service、反向代理 服务
@@ -142,7 +139,7 @@ public final class Deploy {
var future2 = vertx.deployVerticle(ServiceVerticle.class, getWorkDeploymentOptions("Service"));
var future3 = vertx.deployVerticle(ReverseProxyVerticle.class, getWorkDeploymentOptions("proxy"));
CompositeFuture.all(future1, future2, future3, future0)
Future.all(future1, future2, future3, future0)
.onSuccess(this::deployWorkVerticalSuccess)
.onFailure(this::deployVerticalFailed);
}
@@ -181,7 +178,7 @@ public final class Deploy {
private DeploymentOptions getWorkDeploymentOptions(String name, int ins) {
return new DeploymentOptions()
.setWorkerPoolName(name)
.setWorker(true)
.setThreadingModel(ThreadingModel.WORKER)
.setInstances(ins);
}

View File

@@ -112,7 +112,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
return Integer.compare(routeHandler2.order(), routeHandler1.order());
};
// 获取处理器类列表
List<Class<?>> sortedHandlers = handlers.stream().sorted(comparator).toList();
List<Class<?>> sortedHandlers = handlers.stream().sorted(comparator).collect(Collectors.toList());
for (Class<?> handler : sortedHandlers) {
try {
// 注册请求处理方法
@@ -153,7 +153,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
methodList.addAll(Stream.of(methods).filter(
method -> method.isAnnotationPresent(SockRouteMapper.class)
).toList());
).collect(Collectors.toList()));
// 依次注册处理方法
for (Method method : methodList) {

View File

@@ -6,7 +6,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.vertx.core.json.JsonObject;
import org.apache.commons.lang3.StringUtils;
import java.io.Serial;
import java.io.Serializable;
/**
@@ -17,7 +16,6 @@ import java.io.Serializable;
*/
public class JsonResult<T> implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private static final int SUCCESS_CODE = 200;