Skip to content

Commit 683c75e

Browse files
author
jj
committed
Uplift t-io to jdk 25
1 parent d0fee16 commit 683c75e

File tree

6 files changed

+38
-42
lines changed

6 files changed

+38
-42
lines changed

frameworks/Java/t-io/pom.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>org.t-io</groupId>
1010
<artifactId>tio-http-parent</artifactId>
11-
<version>3.5.5.v20191010-RELEASE</version>
11+
<version>3.8.6.v20240801-RELEASE</version>
1212
</parent>
1313

1414
<properties>
@@ -25,7 +25,6 @@
2525
<artifactId>tio-http-server</artifactId>
2626
</dependency>
2727

28-
<!-- slf4j-logback绑定 -->
2928
<dependency>
3029
<groupId>ch.qos.logback</groupId>
3130
<artifactId>logback-classic</artifactId>
@@ -83,8 +82,8 @@
8382
<artifactId>maven-assembly-plugin</artifactId>
8483
<executions>
8584
<execution>
86-
<id>make-assembly</id> <!--名字任意 -->
87-
<phase>package</phase> <!-- 绑定到package生命周期阶段上 -->
85+
<id>make-assembly</id>
86+
<phase>package</phase>
8887
<goals>
8988
<goal>single</goal>
9089
</goals>

frameworks/Java/t-io/script/pkg.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<fileSet>
2020
<directory>${project.basedir}</directory>
21-
<outputDirectory></outputDirectory>
21+
<outputDirectory/>
2222
<includes>
2323
<include>startup.*</include>
2424
<include>debug.*</include>

frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/TioBenchmarkStarter.java

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,36 @@
77
import org.tio.http.server.benchmark.controller.TestController;
88
import org.tio.http.server.handler.DefaultHttpRequestHandler;
99
import org.tio.http.server.mvc.Routes;
10-
import org.tio.server.ServerTioConfig;
10+
import org.tio.server.TioServerConfig;
1111

1212
/**
13-
* @author tanyaowu
14-
* 2018年6月9日 上午10:30:45
13+
* @author tanyaowu
1514
*/
1615
public class TioBenchmarkStarter {
17-
public static HttpConfig httpConfig;
18-
public static DefaultHttpRequestHandler requestHandler;
19-
public static HttpServerStarter httpServerStarter;
20-
public static ServerTioConfig serverTioConfig;
16+
public static HttpConfig httpConfig;
17+
public static DefaultHttpRequestHandler requestHandler;
18+
public static HttpServerStarter httpServerStarter;
19+
public static TioServerConfig serverTioConfig;
2120

22-
/**
23-
* @param args
24-
* @author tanyaowu
25-
* @throws IOException
26-
*/
27-
public static void main(String[] args) throws Exception {
28-
httpConfig = new HttpConfig(8080, null, null, null);
29-
httpConfig.setUseSession(false);
30-
httpConfig.setWelcomeFile(null);
31-
httpConfig.setCheckHost(false);
32-
httpConfig.setCompatible1_0(false);
21+
/**
22+
* @param args
23+
* @throws IOException
24+
* @author tanyaowu
25+
*/
26+
public static void main(String[] args) throws Exception {
27+
httpConfig = new HttpConfig(8080, null, null, null);
28+
httpConfig.setUseSession(false);
29+
httpConfig.setWelcomeFile(null);
30+
httpConfig.setCheckHost(false);
31+
httpConfig.setCompatible1_0(false);
3332

34-
Routes routes = new Routes(TestController.class);
33+
Routes routes = new Routes(TestController.class);
3534

36-
requestHandler = new DefaultHttpRequestHandler(httpConfig, routes);
37-
requestHandler.setCompatibilityAssignment(false);
38-
httpServerStarter = new HttpServerStarter(httpConfig, requestHandler);
39-
serverTioConfig = httpServerStarter.getServerTioConfig();
40-
serverTioConfig.statOn = false;
41-
httpServerStarter.start();
42-
}
35+
requestHandler = new DefaultHttpRequestHandler(httpConfig, routes);
36+
requestHandler.setCompatibilityAssignment(false);
37+
httpServerStarter = new HttpServerStarter(httpConfig, requestHandler);
38+
serverTioConfig = httpServerStarter.getTioServerConfig();
39+
serverTioConfig.statOn = false;
40+
httpServerStarter.start();
41+
}
4342
}

frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/controller/TestController.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public HttpResponse json(HttpRequest request) throws Exception {
2828
ret.setBody(Json.toJson(new Message(HELLO_WORLD)).getBytes());
2929
ret.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON);
3030
return ret;
31-
32-
//简便写法
33-
// return Resps.json(request, new Message(HELLO_WORLD));
3431
}
3532

3633
@RequestPath(value = "plaintext")
@@ -41,7 +38,5 @@ public HttpResponse plaintext(HttpRequest request) throws Exception {
4138
ret.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_TXT);
4239
return ret;
4340

44-
//简便写法
45-
// return Resps.bytesWithContentType(request, HELLO_WORLD_BYTES, MimeType.TEXT_PLAIN_TXT.getType());
4641
}
4742
}

frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/model/Message.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
/**
44
* @author tanyaowu
5-
* 2018年6月9日 上午10:06:26
65
*/
76
public final class Message {
87
private final String message;
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
FROM maven:3.6.1-jdk-11-slim as maven
1+
FROM maven:3-eclipse-temurin-24-alpine as maven
22
WORKDIR /t-io
33
COPY pom.xml pom.xml
44
COPY src src
55
COPY script script
6-
RUN mvn package -q
6+
RUN mvn compile assembly:single -q
77

8-
#TODO use separate JDK/JRE for the RUN (as the other builds)
9-
WORKDIR /t-io/target/tio-http-server-benchmark
8+
FROM openjdk:25-jdk-slim
9+
WORKDIR /t-io
10+
COPY --from=maven /t-io/target/tio-http-server-benchmark/config /t-io/config
11+
COPY --from=maven /t-io/target/tio-http-server-benchmark/lib /t-io/lib
12+
13+
WORKDIR /t-io
1014

1115
EXPOSE 8080
1216

13-
CMD ["java", "-server", "-Xms1G", "-Xmx1G", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-Dpacket.handler.mode=queue1", "-cp", "/t-io/target/tio-http-server-benchmark/config:/t-io/target/tio-http-server-benchmark/lib/*", "org.tio.http.server.benchmark.TioBenchmarkStarter"]
17+
CMD ["java", "-server", "-Xms1G", "-Xmx1G", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-Dpacket.handler.mode=queue1", "-cp", "/t-io/config:/t-io/lib/*", "org.tio.http.server.benchmark.TioBenchmarkStarter"]

0 commit comments

Comments
 (0)