/** The configuration. */
private Configuration configuration;
+ /** Whether we’re currently saving the configuration. */
+ private boolean storingConfiguration = false;
+
/** The identity manager. */
private final IdentityManager identityManager;
/**
* Saves the current options.
*/
- public synchronized void saveConfiguration() {
+ public void saveConfiguration() {
+ synchronized (configuration) {
+ if (storingConfiguration) {
+ logger.log(Level.FINE, "Already storing configuration…");
+ return;
+ }
+ storingConfiguration = true;
+ }
+
/* store the options first. */
try {
configuration.getIntValue("Option/InsertionDelay").setValue(options.getIntegerOption("InsertionDelay").getReal());
} catch (ConfigurationException ce1) {
logger.log(Level.SEVERE, "Could not store configuration!", ce1);
+ } finally {
+ synchronized (configuration) {
+ storingConfiguration = false;
+ }
}
}