-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Virtual thread for User Authenticator
- Loading branch information
Showing
76 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
patches/server/0063-Virtual-thread-for-User-Authenticator.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: HaHaWTH <[email protected]> | ||
Date: Tue, 31 Dec 2024 00:00:00 -0800 | ||
Subject: [PATCH] Virtual thread for User Authenticator | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java | ||
index 0afd30a9a4eb7de7e58e1b91342cca51c771f300..e442fd1b80dd57d4420cab4da69ec3598ffc22d3 100644 | ||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java | ||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java | ||
@@ -76,7 +76,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, | ||
// CraftBukkit end | ||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0); | ||
static final Logger LOGGER = LogUtils.getLogger(); | ||
- private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads | ||
+ private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setThreadFactory(org.dreeam.leaf.config.modules.opt.VT4UserAuthenticator.enabled ? Thread.ofVirtual().factory() : java.util.concurrent.Executors.defaultThreadFactory()).setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads // Leaf - Virtual thread for User Authenticator | ||
private static final int MAX_TICKS_BEFORE_LOGIN = 600; | ||
private final byte[] challenge; | ||
final MinecraftServer server; | ||
diff --git a/src/main/java/org/dreeam/leaf/config/modules/opt/VT4UserAuthenticator.java b/src/main/java/org/dreeam/leaf/config/modules/opt/VT4UserAuthenticator.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..751549c6ddacc40b64dc230064f5eeb6b1a2efca | ||
--- /dev/null | ||
+++ b/src/main/java/org/dreeam/leaf/config/modules/opt/VT4UserAuthenticator.java | ||
@@ -0,0 +1,21 @@ | ||
+package org.dreeam.leaf.config.modules.opt; | ||
+ | ||
+import org.dreeam.leaf.config.ConfigModules; | ||
+import org.dreeam.leaf.config.EnumConfigCategory; | ||
+ | ||
+public class VT4UserAuthenticator extends ConfigModules { | ||
+ | ||
+ public String getBasePath() { | ||
+ return EnumConfigCategory.PERF.getBaseKeyName(); | ||
+ } | ||
+ | ||
+ public static boolean enabled = true; | ||
+ | ||
+ @Override | ||
+ public void onLoaded() { | ||
+ enabled = config.getBoolean(getBasePath() + ".use-virtual-thread-for-user-authenticator", enabled, | ||
+ config.pickStringRegionBased( | ||
+ "Use the new Virtual Thread introduced in JDK 21 for User Authenticator.", | ||
+ "是否为用户验证器使用虚拟线程.")); | ||
+ } | ||
+} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.