From 6a269ffdfc98c7b4bd2b5929632596623391408a Mon Sep 17 00:00:00 2001 From: Spigot Date: Thu, 5 Dec 2013 13:57:12 +1100 Subject: [PATCH] Fix broken async chat. Since Mojang introduced netty, but removed async packet handling, there are now only a few threads available to consume packets. Unfortunately we now have to maintain async chat support. In order to allow Async events to not kill these precious few threads, we do what we did in our Netty implementation, and offload these to their own, decoupled thread pool. By: md_5 --- .../0071-Fix-Broken-Async-Chat.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 CraftBukkit-Patches/0071-Fix-Broken-Async-Chat.patch diff --git a/CraftBukkit-Patches/0071-Fix-Broken-Async-Chat.patch b/CraftBukkit-Patches/0071-Fix-Broken-Async-Chat.patch new file mode 100644 index 0000000000..42945645c7 --- /dev/null +++ b/CraftBukkit-Patches/0071-Fix-Broken-Async-Chat.patch @@ -0,0 +1,37 @@ +From c05e1dfb0778e93a4d62851904fb6029fd369089 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Thu, 5 Dec 2013 13:55:53 +1100 +Subject: [PATCH] Fix Broken Async Chat + + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java +index 604a7af..4dedd01 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInChat.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java +@@ -43,7 +43,20 @@ public class PacketPlayInChat extends Packet { + } + // CraftBukkit end + +- public void handle(PacketListener packetlistener) { +- this.a((PacketPlayInListener) packetlistener); +- } ++ // Spigot Start ++ private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool( ++ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() ); ++ public void handle(final PacketListener packetlistener) ++ { ++ executors.submit( new Runnable() ++ { ++ ++ @Override ++ public void run() ++ { ++ PacketPlayInChat.this.a( (PacketPlayInListener) packetlistener ); ++ } ++ } ); ++ } ++ // Spigot End + } +-- +1.8.3.2 +