mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Changes made to GlobalBlockQueue to help diagnose lag.
This commit is contained in:
parent
fd6fbebd69
commit
ecfb71b08f
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@ -38,8 +39,7 @@ public class GlobalBlockQueue {
|
||||
}
|
||||
return;
|
||||
}
|
||||
} while (((GlobalBlockQueue.this.secondLast = System.currentTimeMillis())
|
||||
- GlobalBlockQueue.this.last) < free);
|
||||
} while (((GlobalBlockQueue.this.secondLast = System.currentTimeMillis())- GlobalBlockQueue.this.last) < free);
|
||||
}
|
||||
};
|
||||
|
||||
@ -81,17 +81,16 @@ public class GlobalBlockQueue {
|
||||
return false;
|
||||
}
|
||||
running.set(true);
|
||||
TaskManager.runTaskRepeat(() -> {
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override public void run() {
|
||||
if (inactiveQueues.isEmpty() && activeQueues.isEmpty()) {
|
||||
lastSuccess = System.currentTimeMillis();
|
||||
tasks();
|
||||
GlobalBlockQueue.this.tasks();
|
||||
return;
|
||||
}
|
||||
SET_TASK.value1 = 50 + Math.min(
|
||||
(50 + GlobalBlockQueue.this.last) - (GlobalBlockQueue.this.last =
|
||||
System.currentTimeMillis()),
|
||||
SET_TASK.value1 = 50 + Math.min((50 + GlobalBlockQueue.this.last) - (GlobalBlockQueue.this.last = System.currentTimeMillis()),
|
||||
GlobalBlockQueue.this.secondLast - System.currentTimeMillis());
|
||||
SET_TASK.value2 = getNextQueue();
|
||||
SET_TASK.value2 = GlobalBlockQueue.this.getNextQueue();
|
||||
if (SET_TASK.value2 == null) {
|
||||
return;
|
||||
}
|
||||
@ -126,6 +125,7 @@ public class GlobalBlockQueue {
|
||||
// Enable it again (note that we are still on the main thread)
|
||||
SET_TASK.value2.endSet(true);
|
||||
}
|
||||
}
|
||||
}, 1);
|
||||
return true;
|
||||
}
|
||||
@ -205,7 +205,9 @@ public class GlobalBlockQueue {
|
||||
} else {
|
||||
ArrayList<Thread> threads = new ArrayList<>();
|
||||
for (int i = 0; i < PARALLEL_THREADS; i++) {
|
||||
threads.add(new Thread(SET_TASK));
|
||||
Thread thread = new Thread(SET_TASK);
|
||||
thread.setName("PlotSquared Flush Task");
|
||||
threads.add(thread);
|
||||
}
|
||||
for (Thread thread : threads) {
|
||||
thread.start();
|
||||
|
Loading…
Reference in New Issue
Block a user