Browse Source

适配最新版

zhengjw22 8 months ago
parent
commit
1347601272

+ 1 - 1
frameworks/Java/smart-socket/pom.xml

@@ -11,7 +11,7 @@
         <maven.compiler.source>21</maven.compiler.source>
         <maven.compiler.target>21</maven.compiler.target>
         <log4j.version>2.17.1</log4j.version>
-        <smartservlet.version>2.3</smartservlet.version>
+        <smartservlet.version>2.4</smartservlet.version>
         <hikaricp.version>5.0.0</hikaricp.version>
         <jsoniter.version>0.9.23</jsoniter.version>
     </properties>

+ 1 - 3
frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java

@@ -53,9 +53,7 @@ public class Bootstrap {
                 .threadNum(cpuNum)
                 .headerLimiter(0)
                 .readBufferSize(1024 * 4)
-                .writeBufferSize(1024 * 4)
-                .readMemoryPool(16384 * 1024 * 4)
-                .writeMemoryPool(10 * 1024 * 1024 * cpuNum, cpuNum);
+                .writeBufferSize(1024 * 4);
         bootstrap.httpHandler(routeHandle).setPort(8080).start();
     }
 

+ 4 - 25
frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java

@@ -1,17 +1,11 @@
 package org.smartboot.servlet;
 
 
-import org.smartboot.http.server.HttpBootstrap;
-import org.smartboot.http.server.HttpRequest;
-import org.smartboot.http.server.HttpResponse;
-import org.smartboot.http.server.HttpServerHandler;
 import tech.smartboot.servlet.Container;
 import tech.smartboot.servlet.ServletContextRuntime;
 import tech.smartboot.servlet.conf.ServletInfo;
 import tech.smartboot.servlet.conf.ServletMappingInfo;
 
-import java.util.concurrent.CompletableFuture;
-
 /**
  * @author 三刀([email protected]
  * @version V1.0 , 2020/12/22
@@ -38,26 +32,11 @@ public class Bootstrap {
         applicationRuntime.getDeploymentInfo().addServlet(jsonServletInfo);
         applicationRuntime.getDeploymentInfo().addServletMapping(new ServletMappingInfo(jsonServletInfo.getServletName(), "/json"));
         containerRuntime.addRuntime(applicationRuntime);
-
         int cpuNum = Runtime.getRuntime().availableProcessors();
         // 定义服务器接受的消息类型以及各类消息对应的处理器
-        HttpBootstrap bootstrap = new HttpBootstrap();
-        bootstrap.configuration()
-                .threadNum(cpuNum)
-                .bannerEnabled(false)
-                .headerLimiter(0)
-                .readBufferSize(1024 * 4)
-                .writeBufferSize(1024 * 4)
-                .readMemoryPool(16384 * 1024 * 4)
-                .writeMemoryPool(10 * 1024 * 1024 * cpuNum, cpuNum);
-        containerRuntime.start(bootstrap.configuration());
-        bootstrap.setPort(8080)
-                .httpHandler(new HttpServerHandler() {
-                    @Override
-                    public void handle(HttpRequest request, HttpResponse response, CompletableFuture<Object> completableFuture) throws Throwable {
-                        containerRuntime.doHandle(request, response, completableFuture);
-                    }
-                })
-                .start();
+        containerRuntime.getConfiguration()
+                .setThreadNum(cpuNum)
+                .setReadBufferSize(1024 * 4);
+        containerRuntime.start();
     }
 }