mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Name craft scheduler threads according to the plugin using them
Provides quick access to culprits running far more threads than they should be
This commit is contained in:
parent
32107198d1
commit
e14d95e83c
1 changed files with 5 additions and 1 deletions
|
@ -25,7 +25,10 @@ class CraftAsyncTask extends CraftTask {
|
|||
@Override
|
||||
public void run() {
|
||||
final Thread thread = Thread.currentThread();
|
||||
synchronized (this.workers) {
|
||||
// Paper start - name threads according to running plugin
|
||||
final String nameBefore = thread.getName();
|
||||
thread.setName(nameBefore + " - " + this.getOwner().getName());
|
||||
try { synchronized (this.workers) { // Paper end - name threads according to running plugin
|
||||
if (this.getPeriod() == CraftTask.CANCEL) {
|
||||
// Never continue running after cancelled.
|
||||
// Checking this with the lock is important!
|
||||
|
@ -92,6 +95,7 @@ class CraftAsyncTask extends CraftTask {
|
|||
}
|
||||
}
|
||||
}
|
||||
} finally { thread.setName(nameBefore); } // Paper - name threads according to running plugin
|
||||
}
|
||||
|
||||
LinkedList<BukkitWorker> getWorkers() {
|
||||
|
|
Loading…
Reference in a new issue