Skip to content

Commit 2a409fd

Browse files
committed
添加 solon-server newVirtualThreadFactory 名字前缀支持
1 parent 2cd6e7d commit 2a409fd

6 files changed

Lines changed: 8 additions & 7 deletions

File tree

UPDATE_LOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
### v3.8.1
33

44
* 新增 `solon-net-httputils-java11` 插件 //还有问题
5+
* 添加 `solon-server` newVirtualThreadFactory 名字前缀支持
56
* 调整 项目的默认 java 版本改为 11;需要 17 的模块则指定 17
67

78
### v3.8.0

solon-java17-projects/solon-net/solon-net-httputils-java11/src/main/java/org/noear/solon/net/http/impl/jdk/JdkHttpDispatcherLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public ExecutorService getDispatcher() {
3737
try {
3838
if (dispatcher == null) {
3939
if (Solon.appIf(app -> app.cfg().isEnabledVirtualThreads())) {
40-
dispatcher = ThreadsUtil.newVirtualThreadPerTaskExecutor();
40+
dispatcher = ThreadsUtil.newVirtualThreadPerTaskExecutor("http-dispatcher-");
4141
} else {
4242
dispatcher = new ThreadPoolExecutor(0, Integer.MAX_VALUE,
4343
60, TimeUnit.SECONDS,
4444
new SynchronousQueue<>()
45-
, new NamedThreadFactory("http-dispatcher").daemon(false));
45+
, new NamedThreadFactory("http-dispatcher-").daemon(false));
4646
}
4747
}
4848
} finally {

solon-java17-projects/solon-net/solon-net-httputils-java11/src/main/java/org/noear/solon/net/http/impl/okhttp/OkHttpDispatcherLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public Dispatcher getDispatcher() {
3535
try {
3636
if (dispatcher == null) {
3737
if (Solon.appIf(app -> app.cfg().isEnabledVirtualThreads())) {
38-
dispatcher = new Dispatcher(ThreadsUtil.newVirtualThreadPerTaskExecutor());
38+
dispatcher = new Dispatcher(ThreadsUtil.newVirtualThreadPerTaskExecutor("okhttp-"));
3939
} else {
4040
dispatcher = new Dispatcher();
4141
dispatcher.setMaxRequests(Integer.MAX_VALUE);

solon-java17-projects/solon-server/solon-server-jetty-jakarta/src/main/java/org/noear/solon/server/jetty/JettyServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected void setup(String host, int port) throws IOException {
6161

6262
//支持虚拟线程池
6363
if (Solon.appIf(app -> app.cfg().isEnabledVirtualThreads())) {
64-
threadPool.setVirtualThreadsExecutor(ThreadsUtil.newVirtualThreadPerTaskExecutor());
64+
threadPool.setVirtualThreadsExecutor(ThreadsUtil.newVirtualThreadPerTaskExecutor("jetty-"));
6565
}
6666

6767
real = new Server(threadPool);

solon-java17-projects/solon-server/solon-server-tomcat-jakarta/src/main/java/org/noear/solon/server/tomcat/TomcatServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected void addConnector(int port, boolean isMain) throws IOException {
111111

112112
if (Solon.appIf(app -> app.cfg().isEnabledVirtualThreads())) {
113113
//支持虚拟线程池
114-
protocol.setExecutor(ThreadsUtil.newVirtualThreadPerTaskExecutor());
114+
protocol.setExecutor(ThreadsUtil.newVirtualThreadPerTaskExecutor("tomcat-"));
115115
}
116116

117117

solon-java17-projects/solon-server/solon-server-undertow-jakarta/src/main/java/org/noear/solon/server/undertow/UndertowServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ protected HttpHandler buildHandler() throws Exception {
133133

134134
if (Solon.appIf(app -> app.cfg().isEnabledVirtualThreads())) {
135135
//支持虚拟线程池
136-
builder.setExecutor(ThreadsUtil.newVirtualThreadPerTaskExecutor());
137-
builder.setAsyncExecutor(ThreadsUtil.newVirtualThreadPerTaskExecutor());
136+
builder.setExecutor(ThreadsUtil.newVirtualThreadPerTaskExecutor("undertow-"));
137+
builder.setAsyncExecutor(ThreadsUtil.newVirtualThreadPerTaskExecutor("undertow-async-"));
138138
}
139139

140140
//添加servlet

0 commit comments

Comments
 (0)