Bump MCUtils#asyncExecutor core size

Long ago we discovered that the default thread pools would not increase
the number of threads running the pool until queue addition failed.
Bumping the core size mitigates an issue with spark-paper, and in general,
keeping async threads around generally beats having to spin new ones
everytime we want to execute a periodic async task.
This commit is contained in:
Shane Freeder 2024-07-26 13:43:48 +01:00
parent 5a5035be96
commit e1462a9253
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C

View file

@ -4077,7 +4077,7 @@ index 0000000000000000000000000000000000000000..197224e31175252d8438a8df585bbb65
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..c9bebadaf4be03cc92774b7367aeecdd380046f1
index 0000000000000000000000000000000000000000..0449d4619e3a0752dea0981fb149542e23076c52
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -0,0 +1,176 @@
@ -4114,7 +4114,7 @@ index 0000000000000000000000000000000000000000..c9bebadaf4be03cc92774b7367aeecdd
+ }
+ };
+ public static final ThreadPoolExecutor asyncExecutor = new ThreadPoolExecutor(
+ 0, 2, 60L, TimeUnit.SECONDS,
+ 2, 2, 60L, TimeUnit.SECONDS,
+ new LinkedBlockingQueue<>(),
+ new ThreadFactoryBuilder()
+ .setNameFormat("Paper Async Task Handler Thread - %1$d")