Performance tuning, improve workaround for bukkit scheduler bugs

This commit is contained in:
Mike Primm 2011-07-19 00:52:05 -05:00
parent b51bb22b9e
commit 2c16c800e9
14 changed files with 412 additions and 303 deletions

View file

@ -300,7 +300,6 @@ public class MapManager {
public void run() {
int cnt = max_chunk_loads_per_tick;
long tick = System.currentTimeMillis();
while(cnt > 0) {
MapChunkCache c = chunkloads.peek();
if(c == null)
@ -313,16 +312,14 @@ public class MapManager {
}
}
}
if(mapman.scheduler != null) {
/* Detect if bukkit is being stupid - add delay of 1 tick if we're being overfed */
if((tick - last_tick) >= 35) { /* If at least 35msec since last run, try immediate */
mapman.scheduler.scheduleSyncDelayedTask(mapman.plug_in, this);
}
else {
mapman.scheduler.scheduleSyncDelayedTask(mapman.plug_in, this, 1);
}
last_tick = tick;
if((tick - last_tick) < 30) {
Log.info("Chunk fetch running too often - " + (tick-last_tick) + "msec - rescheduled");
scheduler.scheduleSyncDelayedTask(plug_in, this, 2);
}
else {
scheduler.scheduleSyncDelayedTask(plug_in, this, 1);
}
last_tick = tick;
}
}
@ -375,9 +372,9 @@ public class MapManager {
}
scheduler.scheduleSyncRepeatingTask(plugin, new CheckWorldTimes(), 5*20, 5*20); /* Check very 5 seconds */
// scheduler.scheduleSyncRepeatingTask(plugin, new ProcessChunkLoads(), 1, 2);
/* Chunk loader task - work around bukkit issue */
scheduler.scheduleSyncDelayedTask(plugin, new ProcessChunkLoads());
/* Workaround for Bukkit scheduler */
ProcessChunkLoads pc = new ProcessChunkLoads();
scheduler.scheduleSyncDelayedTask(plugin, pc, 1);
}
void renderFullWorld(Location l, CommandSender sender) {