Added config option "fill-memory-tolerance" which defaults to 500. If/when the Fill process pauses due to low memory (<200 MB), this setting is the amount of free memory (in MB) required to be available before it automatically continues.

This option isn't made available to change through a command as most people shouldn't change it. It's been made available for people who are running extremely low memory (and thus necessarily tiny) servers which have less than 768 MB memory available to their CraftBukkit server.
This commit is contained in:
Brettflan 2014-01-20 12:51:44 -06:00
parent 9f7719074f
commit 66390223c6
2 changed files with 9 additions and 1 deletions

View File

@ -51,6 +51,7 @@ public class Config
private static boolean killPlayer = false;
private static boolean denyEnderpearl = false;
private static int fillAutosaveFrequency = 30;
private static int fillMemoryTolerance = 500;
// for monitoring plugin efficiency
// public static long timeUsed = 0;
@ -453,6 +454,11 @@ public class Config
return (int)((rt.maxMemory() - rt.totalMemory() + rt.freeMemory()) / 1048576); // 1024*1024 = 1048576 (bytes in 1 MB)
}
public static boolean AvailableMemoryTooLow()
{
return AvailableMemory() < fillMemoryTolerance;
}
public static boolean HasPermission(Player player, String request)
{
@ -529,6 +535,7 @@ public class Config
denyEnderpearl = cfg.getBoolean("deny-enderpearl", false);
fillAutosaveFrequency = cfg.getInt("fill-autosave-frequency", 30);
bypassPlayers = Collections.synchronizedSet(new LinkedHashSet<String>(cfg.getStringList("bypass-list")));
fillMemoryTolerance = cfg.getInt("fill-memory-tolerance", 500);
StartBorderTimer();
@ -626,6 +633,7 @@ public class Config
cfg.set("deny-enderpearl", denyEnderpearl);
cfg.set("fill-autosave-frequency", fillAutosaveFrequency);
cfg.set("bypass-list", new ArrayList(bypassPlayers));
cfg.set("fill-memory-tolerance", fillMemoryTolerance);
cfg.set("worlds", null);
Iterator world = borders.entrySet().iterator();

View File

@ -140,7 +140,7 @@ public class WorldFillTask implements Runnable
if (pausedForMemory)
{ // if available memory gets too low, we automatically pause, so handle that
if (Config.AvailableMemory() < 500)
if (Config.AvailableMemoryTooLow())
return;
pausedForMemory = false;