From 00655f724d5db2a86ec53f63e16ed005bdb464fe Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 27 May 2014 06:18:34 +0100 Subject: [PATCH] Revert writecount reset, this could cause odd behavior. --- .../com/earth2me/essentials/EssentialsConf.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index ce3d43280..0352007e8 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -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() { try { - if (pendingDiskWrites.get() > 0) - { - pendingDiskWrites.set(0); - } Future future = delayedSave(configFile); if (future != null) { @@ -342,10 +340,7 @@ public class EssentialsConf extends YamlConfiguration public synchronized void cleanup() { - if (pendingDiskWrites.get() > 0) - { - forceSave(); - } + forceSave(); } private Future delayedSave(final File file) @@ -362,11 +357,6 @@ public class EssentialsConf extends YamlConfiguration return null; } - if (pendingDiskWrites.incrementAndGet() < 0) - { - pendingDiskWrites.set(1); - } - Future future = EXECUTOR_SERVICE.submit(new WriteRunner(configFile, data, pendingDiskWrites)); return future;