projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add all posts that have the current Sone as recipient.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
core
/
Core.java
diff --git
a/src/main/java/net/pterodactylus/sone/core/Core.java
b/src/main/java/net/pterodactylus/sone/core/Core.java
index
2ef2d57
..
1a92901
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/Core.java
+++ b/
src/main/java/net/pterodactylus/sone/core/Core.java
@@
-86,6
+86,9
@@
public class Core implements IdentityListener {
/** The configuration. */
private Configuration configuration;
/** The configuration. */
private Configuration configuration;
+ /** Whether we’re currently saving the configuration. */
+ private boolean storingConfiguration = false;
+
/** The identity manager. */
private final IdentityManager identityManager;
/** The identity manager. */
private final IdentityManager identityManager;
@@
-1306,6
+1309,7
@@
public class Core implements IdentityListener {
if (newPosts.remove(post.getId())) {
knownPosts.add(post.getId());
coreListenerManager.fireMarkPostKnown(post);
if (newPosts.remove(post.getId())) {
knownPosts.add(post.getId());
coreListenerManager.fireMarkPostKnown(post);
+ saveConfiguration();
}
}
}
}
}
}
@@
-1386,6
+1390,7
@@
public class Core implements IdentityListener {
if (newReplies.remove(reply.getId())) {
knownReplies.add(reply.getId());
coreListenerManager.fireMarkReplyKnown(reply);
if (newReplies.remove(reply.getId())) {
knownReplies.add(reply.getId());
coreListenerManager.fireMarkReplyKnown(reply);
+ saveConfiguration();
}
}
}
}
}
}
@@
-1406,6
+1411,7
@@
public class Core implements IdentityListener {
soneInserter.stop();
}
}
soneInserter.stop();
}
}
+ soneDownloader.stop();
saveConfiguration();
stopped = true;
}
saveConfiguration();
stopped = true;
}
@@
-1413,7
+1419,15
@@
public class Core implements IdentityListener {
/**
* Saves the current options.
*/
/**
* 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());
/* store the options first. */
try {
configuration.getIntValue("Option/InsertionDelay").setValue(options.getIntegerOption("InsertionDelay").getReal());
@@
-1453,6
+1467,10
@@
public class Core implements IdentityListener {
} catch (ConfigurationException ce1) {
logger.log(Level.SEVERE, "Could not store configuration!", ce1);
} catch (ConfigurationException ce1) {
logger.log(Level.SEVERE, "Could not store configuration!", ce1);
+ } finally {
+ synchronized (configuration) {
+ storingConfiguration = false;
+ }
}
}
}
}