Skip to content

Commit cda709d

Browse files
authored
upgrade smart-servlet to 2.4 (#9445)
* update smart-servlet to 0.1.3-SNAPSHOT * update aio-enhance to 1.0.3-SNAPSHOT * smart-servlet bugfix * bugfix * update smart-socket to 1.5.6-SNAPSHOT * remove file * update aio-enhance to 1.0.4-SNAPSHOT * 优化代码 * 优化代码 * update smart-socket to 1.5.6 * config threadNum * update smart-socket to 1.5.7-SNAPSHOT * 优化代码 * update smart-socket to 1.5.10-SNAPSHOT * 优化代码 * 优化代码 * 优化代码 * 异常aio-enhance * 优化代码 * 优化代码 * 优化代码 * remove aio-pro * remove headerLimiter * update hikaricp version * replace json util * 更新线程模型 * upgrade smart-servlet to 0.1.9-SNAPSHOT * config thread num * config thread num * revert code * revert code * upgrade smart-servlet to 0.2.1-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 1.0-SNAPSHOT * upgrade smart-servlet to 1.4 * upgrade smart-servlet to 1.5-SNAPSHOT * 启用虚拟线程 * 启用虚拟线程 * 适配最新版 * 适配最新版 * 适配最新版 * 适配最新版 * 适配最新版 * 适配最新版
1 parent 6d43b7e commit cda709d

File tree

7 files changed

+92
-56
lines changed

7 files changed

+92
-56
lines changed

frameworks/Java/smart-socket/benchmark_config.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
"default": {
66
"json_url": "/json",
77
"plaintext_url": "/plaintext",
8-
"db_url": "/db",
9-
"query_url": "/queries?queries=",
10-
"update_url": "/updates?queries=",
118
"port": 8080,
129
"approach": "Realistic",
1310
"classification": "Platform",

frameworks/Java/smart-socket/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<maven.compiler.source>21</maven.compiler.source>
1212
<maven.compiler.target>21</maven.compiler.target>
1313
<log4j.version>2.17.1</log4j.version>
14-
<smartservlet.version>2.3</smartservlet.version>
14+
<smartservlet.version>2.5</smartservlet.version>
1515
<hikaricp.version>5.0.0</hikaricp.version>
1616
<jsoniter.version>0.9.23</jsoniter.version>
1717
</properties>

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

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,32 @@
1818
import org.smartboot.http.server.handler.HttpRouteHandler;
1919

2020
import javax.sql.DataSource;
21-
import java.io.IOException;
2221

2322
public class Bootstrap {
2423
static byte[] body = "Hello, World!".getBytes();
2524

2625
public static void main(String[] args) {
27-
HttpRouteHandler routeHandle = new HttpRouteHandler();
28-
routeHandle
29-
.route("/plaintext", new HttpServerHandler() {
30-
31-
32-
@Override
33-
public void handle(HttpRequest request, HttpResponse response) throws IOException {
34-
response.setContentLength(body.length);
35-
response.setContentType("text/plain; charset=UTF-8");
36-
response.write(body);
37-
}
38-
})
39-
.route("/json", new HttpServerHandler() {
40-
41-
@Override
42-
public void handle(HttpRequest request, HttpResponse response) throws IOException {
43-
44-
response.setContentType("application/json");
45-
JsonUtil.writeJsonBytes(response, new Message("Hello, World!"));
46-
}
47-
});
48-
initDB(routeHandle);
4926
int cpuNum = Runtime.getRuntime().availableProcessors();
5027
// 定义服务器接受的消息类型以及各类消息对应的处理器
5128
HttpBootstrap bootstrap = new HttpBootstrap();
5229
bootstrap.configuration()
5330
.threadNum(cpuNum)
5431
.headerLimiter(0)
5532
.readBufferSize(1024 * 4)
56-
.writeBufferSize(1024 * 4)
57-
.readMemoryPool(16384 * 1024 * 4)
58-
.writeMemoryPool(10 * 1024 * 1024 * cpuNum, cpuNum);
59-
bootstrap.httpHandler(routeHandle).setPort(8080).start();
33+
.writeBufferSize(1024 * 4);
34+
bootstrap.httpHandler(new HttpServerHandler() {
35+
@Override
36+
public void handle(HttpRequest request, HttpResponse response) throws Throwable {
37+
if ("/plaintext".equals(request.getRequestURI())) {
38+
response.setContentLength(body.length);
39+
response.setContentType("text/plain; charset=UTF-8");
40+
response.write(body);
41+
} else if ("/json".equals(request.getRequestURI())) {
42+
response.setContentType("application/json");
43+
JsonUtil.writeJsonBytes(response, new Message("Hello, World!"));
44+
}
45+
}
46+
}).setPort(8080).start();
6047
}
6148

6249
private static void initDB(HttpRouteHandler routeHandle) {
Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
package org.smartboot.servlet;
22

33

4-
import org.smartboot.http.server.HttpBootstrap;
5-
import org.smartboot.http.server.HttpRequest;
6-
import org.smartboot.http.server.HttpResponse;
7-
import org.smartboot.http.server.HttpServerHandler;
84
import tech.smartboot.servlet.Container;
95
import tech.smartboot.servlet.ServletContextRuntime;
106
import tech.smartboot.servlet.conf.ServletInfo;
117
import tech.smartboot.servlet.conf.ServletMappingInfo;
128

13-
import java.util.concurrent.CompletableFuture;
14-
159
/**
1610
* @author 三刀([email protected]
1711
* @version V1.0 , 2020/12/22
1812
*/
1913
public class Bootstrap {
2014

2115
public static void main(String[] args) throws Throwable {
16+
System.setProperty("smart-servlet-spring-boot-starter","true");
2217
Container containerRuntime = new Container();
2318
// plaintext
2419
ServletContextRuntime applicationRuntime = new ServletContextRuntime(null, Thread.currentThread().getContextClassLoader(), "/");
@@ -38,26 +33,13 @@ public static void main(String[] args) throws Throwable {
3833
applicationRuntime.getDeploymentInfo().addServlet(jsonServletInfo);
3934
applicationRuntime.getDeploymentInfo().addServletMapping(new ServletMappingInfo(jsonServletInfo.getServletName(), "/json"));
4035
containerRuntime.addRuntime(applicationRuntime);
41-
4236
int cpuNum = Runtime.getRuntime().availableProcessors();
4337
// 定义服务器接受的消息类型以及各类消息对应的处理器
44-
HttpBootstrap bootstrap = new HttpBootstrap();
45-
bootstrap.configuration()
46-
.threadNum(cpuNum)
47-
.bannerEnabled(false)
48-
.headerLimiter(0)
49-
.readBufferSize(1024 * 4)
50-
.writeBufferSize(1024 * 4)
51-
.readMemoryPool(16384 * 1024 * 4)
52-
.writeMemoryPool(10 * 1024 * 1024 * cpuNum, cpuNum);
53-
containerRuntime.start(bootstrap.configuration());
54-
bootstrap.setPort(8080)
55-
.httpHandler(new HttpServerHandler() {
56-
@Override
57-
public void handle(HttpRequest request, HttpResponse response, CompletableFuture<Object> completableFuture) throws Throwable {
58-
containerRuntime.doHandle(request, response, completableFuture);
59-
}
60-
})
61-
.start();
38+
containerRuntime.getConfiguration()
39+
.setThreadNum(cpuNum)
40+
.setReadBufferSize(1024 * 4);
41+
containerRuntime.initialize();
42+
containerRuntime.start();
43+
6244
}
6345
}
Binary file not shown.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIEhTCCAu2gAwIBAgIQF5C4/s1tNk9arohyD4J2UDANBgkqhkiG9w0BAQsFADCB
3+
nzEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMTowOAYDVQQLDDF6aGVu
4+
Z2p3MjJtYWMxMjNAemhlbmdqdzIyTWFjMTIzLmxvY2FsICh6aGVuZ2p3MjIpMUEw
5+
PwYDVQQDDDhta2NlcnQgemhlbmdqdzIybWFjMTIzQHpoZW5nancyMk1hYzEyMy5s
6+
b2NhbCAoemhlbmdqdzIyKTAeFw0yNDAyMTUwNzU3NTNaFw0yNjA1MTUwNzU3NTNa
7+
MGUxJzAlBgNVBAoTHm1rY2VydCBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTE6MDgG
8+
A1UECwwxemhlbmdqdzIybWFjMTIzQHpoZW5nancyMk1hYzEyMy5sb2NhbCAoemhl
9+
bmdqdzIyKTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALvMsE1RIalU
10+
Kzy+4U+Ixw+Z8FL3KHiK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6wOBOz3cHxsFMSDOVy36DfzGeBjMJjhvwq4Mdzu9HV
45+
fYqUJHQBGdK/wGOMOto32E/hbIVhWwxsPZvpeb3h8lhOHVTJN0HbqrZbDLPObjlE
46+
Dlx67ILOEwKBgB4CUV6dRNQTDqh9tVCHHllwKOMZ5P8PlWvnI9Qjo7SuG2obQ5GD
47+
UB3e67m+IhzilUs82rIbLKpp4CPHjOCdEIlMLgbL1lxsrRsAzwe3mIgDYnAVHQQZ
48+
A7V+dgUGaQyBEc5Pq3gbOXRnCs10GTr69z7hCozGGCC3mUWVO/TZRe23AoGBAOFI
49+
y0LaAUPHstS8H2oyU8a0qqSFQ01YemugN+Bf9iHa1GSVNO5mv7upkkZbHu+TAAUq
50+
ZgvLdfEdSUKqW7Tt8XpP8Zhi/qDxV63fblhmsjsZvSwyYnI/UOMjZ4+IcCRb/8ZT
51+
mdxhzYl1Z9YJ+119IFapi0h+IO2UwBzkq2iOJg+zAoGBALJSi+nD7/lhA/HKu8Nr
52+
sh4G6tczLMOHN+jvngf5WoGEnBM1ENUtmMiH0YvBIpyHSHgyKwq+H29fgA5f42Eb
53+
xe7HfOye3a3OmmJvzkckEs5Ms1J4ahErwRUvM5+xsCG5bdpA/p61sy14W3eYyA/r
54+
tSSrxN4ernLg7k/vNHB0NIjK
55+
-----END PRIVATE KEY-----
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Copyright (c) 2017-2020, org.smartboot. All rights reserved.
3+
# project name: smart-servlet
4+
# file name: smart-servlet.properties
5+
# Date: 2020-12-10
6+
# Author: sandao ([email protected])
7+
#
8+
#
9+
http.port=8080
10+
http.readBufferSize=8192
11+
#http.threadNum=10
12+
root.context=ROOT
13+
## tls/ssl
14+
ssl.enable=false
15+
ssl.port=443

0 commit comments

Comments
 (0)