Skip to content

Commit 516c764

Browse files
committed
Merge branch '3.2.x' into 3.3.x
Closes gh-41976
2 parents 77d62dd + 5ee5225 commit 516c764

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskExecutionProperties.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -84,30 +84,32 @@ public static class Pool {
8484

8585
/**
8686
* Queue capacity. An unbounded capacity does not increase the pool and therefore
87-
* ignores the "max-size" property.
87+
* ignores the "max-size" property. Doesn't have an effect if virtual threads are
88+
* enabled.
8889
*/
8990
private int queueCapacity = Integer.MAX_VALUE;
9091

9192
/**
92-
* Core number of threads.
93+
* Core number of threads. Doesn't have an effect if virtual threads are enabled.
9394
*/
9495
private int coreSize = 8;
9596

9697
/**
9798
* Maximum allowed number of threads. If tasks are filling up the queue, the pool
9899
* can expand up to that size to accommodate the load. Ignored if the queue is
99-
* unbounded.
100+
* unbounded. Doesn't have an effect if virtual threads are enabled.
100101
*/
101102
private int maxSize = Integer.MAX_VALUE;
102103

103104
/**
104105
* Whether core threads are allowed to time out. This enables dynamic growing and
105-
* shrinking of the pool.
106+
* shrinking of the pool. Doesn't have an effect if virtual threads are enabled.
106107
*/
107108
private boolean allowCoreThreadTimeout = true;
108109

109110
/**
110-
* Time limit for which threads may remain idle before being terminated.
111+
* Time limit for which threads may remain idle before being terminated. Doesn't
112+
* have an effect if virtual threads are enabled.
111113
*/
112114
private Duration keepAlive = Duration.ofSeconds(60);
113115

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingProperties.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public void setThreadNamePrefix(String threadNamePrefix) {
6363
public static class Pool {
6464

6565
/**
66-
* Maximum allowed number of threads.
66+
* Maximum allowed number of threads. Doesn't have an effect if virtual threads
67+
* are enabled.
6768
*/
6869
private int size = 1;
6970

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -925,12 +925,14 @@ public void setBuffered(boolean buffered) {
925925
public static class Threads {
926926

927927
/**
928-
* Maximum amount of worker threads.
928+
* Maximum amount of worker threads. Doesn't have an effect if virtual threads
929+
* are enabled.
929930
*/
930931
private int max = 200;
931932

932933
/**
933-
* Minimum amount of worker threads.
934+
* Minimum amount of worker threads. Doesn't have an effect if virtual threads
935+
* are enabled.
934936
*/
935937
private int minSpare = 10;
936938

@@ -1350,12 +1352,14 @@ public static class Threads {
13501352
private Integer selectors = -1;
13511353

13521354
/**
1353-
* Maximum number of threads.
1355+
* Maximum number of threads. Doesn't have an effect if virtual threads are
1356+
* enabled.
13541357
*/
13551358
private Integer max = 200;
13561359

13571360
/**
1358-
* Minimum number of threads.
1361+
* Minimum number of threads. Doesn't have an effect if virtual threads are
1362+
* enabled.
13591363
*/
13601364
private Integer min = 8;
13611365

spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/spring-application.adoc

+3
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ If you're running on Java 21 or up, you can enable virtual threads by setting th
405405
Before turning on this option for your application, you should consider https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html[reading the official Java virtual threads documentation].
406406
In some cases, applications can experience lower throughput because of "Pinned Virtual Threads"; this page also explains how to detect such cases with JDK Flight Recorder or the `jcmd` CLI.
407407

408+
NOTE: If virtual threads are enabled, properties which configure thread pools don't have an effect anymore.
409+
That's because virtual threads are scheduled on a JVM wide platform thread pool and not on dedicated thread pools.
410+
408411
WARNING: One side effect of virtual threads is that they are daemon threads.
409412
A JVM will exit if all of its threads are daemon threads.
410413
This behavior can be a problem when you rely on `@Scheduled` beans, for example, to keep your application alive.

0 commit comments

Comments
 (0)