From 44c7404b51ee3fc23603221b7c6261a8a118b2ae Mon Sep 17 00:00:00 2001 From: Peter Crawley <49043380+Peter-Crawley@users.noreply.github.com> Date: Sat, 17 Sep 2022 22:58:51 +0100 Subject: [PATCH] Limit size of Authenticator Cache Thread Pool (#8360) --- .../server/Cache-user-authenticator-threads.patch | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/patches/server/Cache-user-authenticator-threads.patch b/patches/server/Cache-user-authenticator-threads.patch index 86dd669002..5c61f9f858 100644 --- a/patches/server/Cache-user-authenticator-threads.patch +++ b/patches/server/Cache-user-authenticator-threads.patch @@ -12,18 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ // Paper start - Cache authenticator threads -+ private static final AtomicInteger threadId = new AtomicInteger(0); -+ private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool( -+ r -> { -+ Thread ret = new Thread(r, "User Authenticator #" + threadId.incrementAndGet()); ++ private static final java.util.concurrent.ExecutorService authenticatorPool = new java.util.concurrent.ThreadPoolExecutor(0, 16, 60L, java.util.concurrent.TimeUnit.SECONDS, new java.util.concurrent.SynchronousQueue<>(), new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads + -+ ret.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)); -+ -+ return ret; -+ } -+ ); -+ // Paper end // Spigot start public void initUUID() {