import net.pterodactylus.util.config.ConfigurationException;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.number.Numbers;
+import net.pterodactylus.util.thread.Ticker;
import net.pterodactylus.util.validation.IntegerRangeValidator;
import net.pterodactylus.util.validation.Validation;
import net.pterodactylus.util.version.Version;
/** Trusted identities, sorted by own identities. */
private Map<OwnIdentity, Set<Identity>> trustedIdentities = Collections.synchronizedMap(new HashMap<OwnIdentity, Set<Identity>>());
+ /** Ticker for threads that mark own elements as known. */
+ private Ticker localElementTicker = new Ticker();
+
/**
* Creates a new core.
*
logger.log(Level.FINE, "Tried to create post for non-local Sone: %s", sone);
return null;
}
- Post post = new Post(sone, time, text);
+ final Post post = new Post(sone, time, text);
if (recipient != null) {
post.setRecipient(recipient);
}
}
sone.addPost(post);
saveSone(sone);
+ localElementTicker.registerEvent(System.currentTimeMillis() + 10 * 1000, new Runnable() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ markPostKnown(post);
+ }
+ }, "Mark " + post + " read.");
return post;
}
logger.log(Level.FINE, "Tried to create reply for non-local Sone: %s", sone);
return null;
}
- Reply reply = new Reply(sone, post, System.currentTimeMillis(), text);
+ final Reply reply = new Reply(sone, post, System.currentTimeMillis(), text);
synchronized (replies) {
replies.put(reply.getId(), reply);
}
}
sone.addReply(reply);
saveSone(sone);
+ localElementTicker.registerEvent(System.currentTimeMillis() + 10 * 1000, new Runnable() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ markReplyKnown(reply);
+ }
+ }, "Mark " + reply + " read.");
return reply;
}
newPost = $(data.post.html).addClass("hidden");
if ($(".post-author-local", newPost).text() == "true") {
newPost.removeClass("new");
- (function(newPost) {
- setTimeout(function() {
- markPostAsKnown(newPost, false);
- }, 5000);
- })(newPost);
}
if (firstOlderPost != null) {
newPost.insertBefore(firstOlderPost);