Paper/CraftBukkit-Patches/0033-Thread-Naming-and-Tweaks.patch

61 lines
3.3 KiB
Diff
Raw Normal View History

From 2ca1c5f5362ab67c2593d4417bc86c7b5c324b57 Mon Sep 17 00:00:00 2001
2013-04-23 03:50:42 +02:00
From: md_5 <md_5@live.com.au>
Date: Tue, 23 Apr 2013 11:50:27 +1000
Subject: [PATCH] Thread Naming and Tweaks
Removes the sleep forever thread and adds useful names for debugging to all staged thread files.
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
2013-07-02 05:03:56 +02:00
index ec3d104..ccbd6bc 100644
2013-04-23 03:50:42 +02:00
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -34,7 +34,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
super(options);
// CraftBukkit end
2013-07-02 05:03:56 +02:00
this.m = new ConsoleLogManager("Minecraft-Server", (String) null, (String) null); // CraftBukkit - null last argument
2013-04-23 03:50:42 +02:00
- new ThreadSleepForever(this);
+ // new ThreadSleepForever(this);
}
protected boolean init() throws java.net.UnknownHostException { // CraftBukkit - throws UnknownHostException
diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java
index 489e184..bfd219c 100644
--- a/src/main/java/net/minecraft/server/ThreadCommandReader.java
+++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java
@@ -11,6 +11,7 @@ class ThreadCommandReader extends Thread {
final DedicatedServer server;
ThreadCommandReader(DedicatedServer dedicatedserver) {
+ super("Command Reader"); // Spigot
this.server = dedicatedserver;
}
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
2013-07-02 05:03:56 +02:00
index f5032be..5e45cae 100644
2013-04-23 03:50:42 +02:00
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
@@ -21,6 +21,7 @@ class ThreadLoginVerifier extends Thread {
CraftServer server;
ThreadLoginVerifier(PendingConnection pendingconnection, CraftServer server) {
+ super("Login Verifier - " + pendingconnection.getName());
this.server = server;
// CraftBukkit end
this.pendingConnection = pendingconnection;
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
2013-06-21 09:42:59 +02:00
index 84dcfcc..a30f217 100644
2013-04-23 03:50:42 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
2013-06-21 09:42:59 +02:00
@@ -71,7 +71,7 @@ public class CraftScheduler implements BukkitScheduler {
2013-04-23 03:50:42 +02:00
*/
private final ConcurrentHashMap<Integer, CraftTask> runners = new ConcurrentHashMap<Integer, CraftTask>();
private volatile int currentTick = -1;
- private final Executor executor = Executors.newCachedThreadPool();
+ private final Executor executor = Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").build()); // Spigot
private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}};
private CraftAsyncDebugger debugTail = debugHead;
private static final int RECENT_TICKS;
--
1.8.1.2
2013-04-23 03:50:42 +02:00