Revert writecount reset, this could cause odd behavior.

This commit is contained in:
KHobbits 2014-05-27 06:18:34 +01:00
parent 4590e7ea26
commit 00655f724d

View file

@ -316,14 +316,12 @@ public class EssentialsConf extends YamlConfiguration
} }
} }
//This may be aborted if there are stagnant requests sitting in queue.
//This needs fixed to discard outstanding save requests.
public synchronized void forceSave() public synchronized void forceSave()
{ {
try try
{ {
if (pendingDiskWrites.get() > 0)
{
pendingDiskWrites.set(0);
}
Future<?> future = delayedSave(configFile); Future<?> future = delayedSave(configFile);
if (future != null) if (future != null)
{ {
@ -342,10 +340,7 @@ public class EssentialsConf extends YamlConfiguration
public synchronized void cleanup() public synchronized void cleanup()
{ {
if (pendingDiskWrites.get() > 0) forceSave();
{
forceSave();
}
} }
private Future<?> delayedSave(final File file) private Future<?> delayedSave(final File file)
@ -362,11 +357,6 @@ public class EssentialsConf extends YamlConfiguration
return null; return null;
} }
if (pendingDiskWrites.incrementAndGet() < 0)
{
pendingDiskWrites.set(1);
}
Future<?> future = EXECUTOR_SERVICE.submit(new WriteRunner(configFile, data, pendingDiskWrites)); Future<?> future = EXECUTOR_SERVICE.submit(new WriteRunner(configFile, data, pendingDiskWrites));
return future; return future;