Synchronize saving to prevent race conditions while saving.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 13 Dec 2010 19:05:36 +0000 (20:05 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 13 Dec 2010 19:05:36 +0000 (20:05 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index 895f570..9eba2b7 100644 (file)
@@ -1117,7 +1117,7 @@ public class Core implements IdentityListener {
         * @param sone
         *            The Sone to save
         */
-       public void saveSone(Sone sone) {
+       public synchronized void saveSone(Sone sone) {
                if (!isLocalSone(sone)) {
                        logger.log(Level.FINE, "Tried to save non-local Sone: %s", sone);
                        return;
@@ -1409,7 +1409,7 @@ public class Core implements IdentityListener {
        /**
         * Saves the current options.
         */
-       public void saveConfiguration() {
+       public synchronized void saveConfiguration() {
                /* store the options first. */
                try {
                        configuration.getIntValue("Option/InsertionDelay").setValue(options.getIntegerOption("InsertionDelay").getReal());