3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00

Identify CraftScheduler threads with useful names

Dieser Commit ist enthalten in:
md_5 2019-01-05 16:21:07 +11:00
Ursprung 7560d3b5ab
Commit a610dcd821

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.scheduler; package org.bukkit.craftbukkit.scheduler;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
@ -80,7 +81,7 @@ public class CraftScheduler implements BukkitScheduler {
*/ */
private volatile CraftTask currentTask = null; private volatile CraftTask currentTask = null;
private volatile int currentTick = -1; private volatile int currentTick = -1;
private final Executor executor = Executors.newCachedThreadPool(); private final Executor executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %d").build());
private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}}; private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}};
private CraftAsyncDebugger debugTail = debugHead; private CraftAsyncDebugger debugTail = debugHead;
private static final int RECENT_TICKS; private static final int RECENT_TICKS;