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