mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-11 02:02:04 -07:00
Add back discard policy
This commit is contained in:
@@ -22,11 +22,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ COMMAND_SENDING_POOL.execute(() -> this.sendAsync(player, commandNodes));
|
+ COMMAND_SENDING_POOL.execute(() -> this.sendAsync(player, commandNodes));
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static final java.util.concurrent.ExecutorService COMMAND_SENDING_POOL = java.util.concurrent.Executors.newFixedThreadPool(2,
|
+ // Fixed pool, but with discard policy
|
||||||
|
+ public static final java.util.concurrent.ExecutorService COMMAND_SENDING_POOL = new java.util.concurrent.ThreadPoolExecutor(
|
||||||
|
+ 2, 2, 0, java.util.concurrent.TimeUnit.MILLISECONDS,
|
||||||
|
+ new java.util.concurrent.LinkedBlockingQueue<>(),
|
||||||
+ new com.google.common.util.concurrent.ThreadFactoryBuilder()
|
+ new com.google.common.util.concurrent.ThreadFactoryBuilder()
|
||||||
+ .setNameFormat("Paper Async Command Builder Thread Pool - %1$d")
|
+ .setNameFormat("Paper Async Command Builder Thread Pool - %1$d")
|
||||||
+ .setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER))
|
+ .setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER))
|
||||||
+ .build()
|
+ .build(),
|
||||||
|
+ new java.util.concurrent.ThreadPoolExecutor.DiscardPolicy()
|
||||||
+ );
|
+ );
|
||||||
+
|
+
|
||||||
+ private void sendAsync(ServerPlayer player, Collection<CommandNode<CommandSourceStack>> dispatcherRootChildren) {
|
+ private void sendAsync(ServerPlayer player, Collection<CommandNode<CommandSourceStack>> dispatcherRootChildren) {
|
||||||
|
Reference in New Issue
Block a user