From: David ‘Bombe’ Roden Date: Mon, 13 Dec 2010 19:05:36 +0000 (+0100) Subject: Synchronize saving to prevent race conditions while saving. X-Git-Tag: beta-freefall-0.6.2-1~189 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=2c5d39efa620a564f9fe12f754d3f5bb3adf37fe;hp=1a46430a766bf1b0911b2a54f4862756043ffd5c Synchronize saving to prevent race conditions while saving. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 895f570..9eba2b7 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -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());