X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=12e700ef33df48551e68f8ddb76f8c0b38c26ffa;hp=e08acd136f1ec212732c879bd98d7407a9e470e6;hb=fdbdc26c744865a7200017cb117943d48df498ad;hpb=ffb2ea1773cf7e3d1b7fc41ab0e9c3c1eed514e0 diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index e08acd1..12e700e 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -17,14 +17,13 @@ package net.pterodactylus.sone.core; +import static com.google.common.base.Optional.fromNullable; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Predicates.not; +import static com.google.common.primitives.Longs.tryParse; import static java.lang.String.format; -import static net.pterodactylus.sone.data.Sone.LOCAL_SONE_FILTER; +import static java.util.logging.Level.WARNING; -import java.net.MalformedURLException; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -40,11 +39,13 @@ import java.util.logging.Level; import java.util.logging.Logger; import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidAlbumFound; +import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidImageFound; import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidParentAlbumFound; import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidPostFound; import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidPostReplyFound; import net.pterodactylus.sone.core.Options.DefaultOption; -import net.pterodactylus.sone.core.SoneInserter.SetInsertionDelay; +import net.pterodactylus.sone.core.SoneChangeDetector.PostProcessor; +import net.pterodactylus.sone.core.SoneChangeDetector.PostReplyProcessor; import net.pterodactylus.sone.core.event.ImageInsertFinishedEvent; import net.pterodactylus.sone.core.event.MarkPostKnownEvent; import net.pterodactylus.sone.core.event.MarkPostReplyKnownEvent; @@ -68,15 +69,16 @@ import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.data.Sone.ShowCustomAvatars; import net.pterodactylus.sone.data.Sone.SoneStatus; -import net.pterodactylus.sone.data.SoneImpl; import net.pterodactylus.sone.data.TemporaryImage; import net.pterodactylus.sone.database.AlbumBuilder; import net.pterodactylus.sone.database.Database; import net.pterodactylus.sone.database.DatabaseException; +import net.pterodactylus.sone.database.ImageBuilder; import net.pterodactylus.sone.database.PostBuilder; import net.pterodactylus.sone.database.PostProvider; import net.pterodactylus.sone.database.PostReplyBuilder; import net.pterodactylus.sone.database.PostReplyProvider; +import net.pterodactylus.sone.database.SoneBuilder; import net.pterodactylus.sone.database.SoneProvider; import net.pterodactylus.sone.fcp.FcpInterface; import net.pterodactylus.sone.freenet.wot.Identity; @@ -101,7 +103,6 @@ import com.google.common.base.Optional; import com.google.common.base.Predicates; import com.google.common.collect.FluentIterable; import com.google.common.collect.HashMultimap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.common.eventbus.EventBus; @@ -109,8 +110,6 @@ import com.google.common.eventbus.Subscribe; import com.google.inject.Inject; import com.google.inject.Singleton; -import freenet.keys.FreenetURI; - /** * The Sone core. * @@ -129,7 +128,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, private final Options options = new Options(); /** The preferences. */ - private final Preferences preferences = new Preferences(options); + private final Preferences preferences; /** The event bus. */ private final EventBus eventBus; @@ -179,10 +178,6 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, /* synchronize access on this on sones. */ private final Map soneRescuers = new HashMap(); - /** All Sones. */ - /* synchronize access on this on itself. */ - private final Map sones = new HashMap(); - /** All known Sones. */ private final Set knownSones = new HashSet(); @@ -233,6 +228,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, this.webOfTrustUpdater = webOfTrustUpdater; this.eventBus = eventBus; this.database = database; + preferences = new Preferences(this.eventBus, options); } @VisibleForTesting @@ -247,6 +243,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, this.webOfTrustUpdater = webOfTrustUpdater; this.eventBus = eventBus; this.database = database; + preferences = new Preferences(this.eventBus, options); } // @@ -309,7 +306,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, public SoneRescuer getSoneRescuer(Sone sone) { checkNotNull(sone, "sone must not be null"); checkArgument(sone.isLocal(), "sone must be local"); - synchronized (sones) { + synchronized (soneRescuers) { SoneRescuer soneRescuer = soneRescuers.get(sone); if (soneRescuer == null) { soneRescuer = new SoneRescuer(this, soneDownloader, sone); @@ -333,14 +330,16 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } } + public SoneBuilder soneBuilder() { + return database.newSoneBuilder(); + } + /** * {@inheritDocs} */ @Override public Collection getSones() { - synchronized (sones) { - return ImmutableSet.copyOf(sones.values()); - } + return database.getSones(); } /** @@ -354,9 +353,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, */ @Override public Optional getSone(String id) { - synchronized (sones) { - return Optional.fromNullable(sones.get(id)); - } + return database.getSone(id); } /** @@ -364,9 +361,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, */ @Override public Collection getLocalSones() { - synchronized (sones) { - return FluentIterable.from(sones.values()).filter(LOCAL_SONE_FILTER).toSet(); - } + return database.getLocalSones(); } /** @@ -374,24 +369,14 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, * * @param id * The ID of the Sone - * @param create - * {@code true} to create a new Sone if none exists, - * {@code false} to return null if none exists * @return The Sone with the given ID, or {@code null} */ - public Sone getLocalSone(String id, boolean create) { - synchronized (sones) { - Sone sone = sones.get(id); - if ((sone == null) && create) { - sone = new SoneImpl(id, true); - sones.put(id, sone); - } - if ((sone != null) && !sone.isLocal()) { - sone = new SoneImpl(id, true); - sones.put(id, sone); - } - return sone; + public Sone getLocalSone(String id) { + Optional sone = database.getSone(id); + if (sone.isPresent() && sone.get().isLocal()) { + return sone.get(); } + return null; } /** @@ -399,30 +384,19 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, */ @Override public Collection getRemoteSones() { - synchronized (sones) { - return FluentIterable.from(sones.values()).filter(not(LOCAL_SONE_FILTER)).toSet(); - } + return database.getRemoteSones(); } /** * Returns the remote Sone with the given ID. * + * * @param id * The ID of the remote Sone to get - * @param create - * {@code true} to always create a Sone, {@code false} to return - * {@code null} if no Sone with the given ID exists * @return The Sone with the given ID */ - public Sone getRemoteSone(String id, boolean create) { - synchronized (sones) { - Sone sone = sones.get(id); - if ((sone == null) && create && (id != null) && (id.length() == 43)) { - sone = new SoneImpl(id, false); - sones.put(id, sone); - } - return sone; - } + public Sone getRemoteSone(String id) { + return database.getSone(id).orNull(); } /** @@ -605,6 +579,10 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, return database.getAlbum(albumId).orNull(); } + public ImageBuilder imageBuilder() { + return database.newImageBuilder(); + } + /** * Returns the image with the given ID, creating it if necessary. * @@ -703,26 +681,20 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, return null; } logger.info(String.format("Adding Sone from OwnIdentity: %s", ownIdentity)); - synchronized (sones) { - final Sone sone; - try { - sone = getLocalSone(ownIdentity.getId(), true).setIdentity(ownIdentity).setInsertUri(new FreenetURI(ownIdentity.getInsertUri())).setRequestUri(new FreenetURI(ownIdentity.getRequestUri())); - } catch (MalformedURLException mue1) { - logger.log(Level.SEVERE, String.format("Could not convert the Identity’s URIs to Freenet URIs: %s, %s", ownIdentity.getInsertUri(), ownIdentity.getRequestUri()), mue1); - return null; - } - sone.setLatestEdition(Numbers.safeParseLong(ownIdentity.getProperty("Sone.LatestEdition"), (long) 0)); - sone.setClient(new Client("Sone", SonePlugin.VERSION.toString())); - sone.setKnown(true); - /* TODO - load posts ’n stuff */ - sones.put(ownIdentity.getId(), sone); - final SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, sone); + Sone sone = database.newSoneBuilder().local().from(ownIdentity).build(); + sone.setLatestEdition(Numbers.safeParseLong(ownIdentity.getProperty("Sone.LatestEdition"), 0L)); + sone.setClient(new Client("Sone", SonePlugin.VERSION.toString())); + sone.setKnown(true); + /* TODO - load posts ’n stuff */ + SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, ownIdentity.getId()); + eventBus.register(soneInserter); + synchronized (soneInserters) { soneInserters.put(sone, soneInserter); - sone.setStatus(SoneStatus.idle); - loadSone(sone); - soneInserter.start(); - return sone; } + loadSone(sone); + sone.setStatus(SoneStatus.idle); + soneInserter.start(); + return sone; } /** @@ -756,33 +728,33 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, logger.log(Level.WARNING, "Given Identity is null!"); return null; } - synchronized (sones) { - final Sone sone = getRemoteSone(identity.getId(), true); - if (sone.isLocal()) { - return sone; + final Long latestEdition = tryParse(fromNullable( + identity.getProperty("Sone.LatestEdition")).or("0")); + Optional existingSone = getSone(identity.getId()); + if (existingSone.isPresent() && existingSone.get().isLocal()) { + return existingSone.get(); + } + boolean newSone = !existingSone.isPresent(); + Sone sone = !newSone ? existingSone.get() : database.newSoneBuilder().from(identity).build(); + sone.setLatestEdition(latestEdition); + if (newSone) { + synchronized (knownSones) { + newSone = !knownSones.contains(sone.getId()); } - sone.setIdentity(identity); - boolean newSone = sone.getRequestUri() == null; - sone.setRequestUri(SoneUri.create(identity.getRequestUri())); - sone.setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), (long) 0)); + sone.setKnown(!newSone); if (newSone) { - synchronized (knownSones) { - newSone = !knownSones.contains(sone.getId()); - } - sone.setKnown(!newSone); - if (newSone) { - eventBus.post(new NewSoneFoundEvent(sone)); - for (Sone localSone : getLocalSones()) { - if (localSone.getOptions().isAutoFollow()) { - followSone(localSone, sone.getId()); - } + eventBus.post(new NewSoneFoundEvent(sone)); + for (Sone localSone : getLocalSones()) { + if (localSone.getOptions().isAutoFollow()) { + followSone(localSone, sone.getId()); } } } - soneDownloader.addSone(sone); - soneDownloaders.execute(soneDownloader.fetchSoneWithUriAction(sone)); - return sone; } + database.storeSone(sone); + soneDownloader.addSone(sone); + soneDownloaders.execute(soneDownloader.fetchSoneWithUriAction(sone)); + return sone; } /** @@ -934,7 +906,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, * {@code true} if the stored Sone should be updated regardless * of the age of the given Sone */ - public void updateSone(Sone sone, boolean soneRescueMode) { + public void updateSone(final Sone sone, boolean soneRescueMode) { Optional storedSone = getSone(sone.getId()); if (storedSone.isPresent()) { if (!soneRescueMode && !(sone.getTime() > storedSone.get().getTime())) { @@ -942,81 +914,46 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, return; } /* find removed posts. */ - Collection removedPosts = new ArrayList(); - Collection newPosts = new ArrayList(); - Collection existingPosts = database.getPosts(sone.getId()); - for (Post oldPost : existingPosts) { - if (!sone.getPosts().contains(oldPost)) { - removedPosts.add(oldPost); - } - } - /* find new posts. */ - for (Post newPost : sone.getPosts()) { - if (existingPosts.contains(newPost)) { - continue; - } - if (newPost.getTime() < getSoneFollowingTime(sone)) { - newPost.setKnown(true); - } else if (!newPost.isKnown()) { - newPosts.add(newPost); - } - } - /* store posts. */ - database.storePosts(sone, sone.getPosts()); - Collection newPostReplies = new ArrayList(); - Collection removedPostReplies = new ArrayList(); - if (!soneRescueMode) { - for (PostReply reply : storedSone.get().getReplies()) { - if (!sone.getReplies().contains(reply)) { - removedPostReplies.add(reply); + SoneChangeDetector soneChangeDetector = new SoneChangeDetector(storedSone.get()); + soneChangeDetector.onNewPosts(new PostProcessor() { + @Override + public void processPost(Post post) { + if (post.getTime() < getSoneFollowingTime(sone)) { + post.setKnown(true); + } else if (!post.isKnown()) { + eventBus.post(new NewPostFoundEvent(post)); } } - } - Set storedReplies = storedSone.get().getReplies(); - for (PostReply reply : sone.getReplies()) { - if (storedReplies.contains(reply)) { - continue; + }); + soneChangeDetector.onRemovedPosts(new PostProcessor() { + @Override + public void processPost(Post post) { + eventBus.post(new PostRemovedEvent(post)); } - if (reply.getTime() < getSoneFollowingTime(sone)) { - reply.setKnown(true); - } else if (!reply.isKnown()) { - newPostReplies.add(reply); - } - } - database.storePostReplies(sone, sone.getReplies()); - for (Album album : storedSone.get().getRootAlbum().getAlbums()) { - database.removeAlbum(album); - for (Image image : album.getImages()) { - database.removeImage(image); - } - } - for (Post removedPost : removedPosts) { - eventBus.post(new PostRemovedEvent(removedPost)); - } - for (Post newPost : newPosts) { - eventBus.post(new NewPostFoundEvent(newPost)); - } - for (PostReply removedPostReply : removedPostReplies) { - eventBus.post(new PostReplyRemovedEvent(removedPostReply)); - } - for (PostReply newPostReply : newPostReplies) { - eventBus.post(new NewPostReplyFoundEvent(newPostReply)); - } - for (Album album : sone.getRootAlbum().getAlbums()) { - database.storeAlbum(album); - for (Image image : album.getImages()) { - database.storeImage(image); + }); + soneChangeDetector.onNewPostReplies(new PostReplyProcessor() { + @Override + public void processPostReply(PostReply postReply) { + if (postReply.getTime() < getSoneFollowingTime(sone)) { + postReply.setKnown(true); + } else if (!postReply.isKnown()) { + eventBus.post(new NewPostReplyFoundEvent(postReply)); + } } - } - synchronized (sones) { - sone.setOptions(storedSone.get().getOptions()); - sone.setKnown(storedSone.get().isKnown()); - sone.setStatus((sone.getTime() == 0) ? SoneStatus.unknown : SoneStatus.idle); - if (sone.isLocal()) { - soneInserters.get(storedSone.get()).setSone(sone); - touchConfiguration(); + }); + soneChangeDetector.onRemovedPostReplies(new PostReplyProcessor() { + @Override + public void processPostReply(PostReply postReply) { + eventBus.post(new PostReplyRemovedEvent(postReply)); } - sones.put(sone.getId(), sone); + }); + soneChangeDetector.detectChanges(sone); + database.storeSone(sone); + sone.setOptions(storedSone.get().getOptions()); + sone.setKnown(storedSone.get().isKnown()); + sone.setStatus((sone.getTime() == 0) ? SoneStatus.unknown : SoneStatus.idle); + if (sone.isLocal()) { + touchConfiguration(); } } } @@ -1034,15 +971,14 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, logger.log(Level.WARNING, String.format("Tried to delete Sone of non-own identity: %s", sone)); return; } - synchronized (sones) { - if (!getLocalSones().contains(sone)) { - logger.log(Level.WARNING, String.format("Tried to delete non-local Sone: %s", sone)); - return; - } - sones.remove(sone.getId()); - SoneInserter soneInserter = soneInserters.remove(sone); - soneInserter.stop(); + if (!getLocalSones().contains(sone)) { + logger.log(Level.WARNING, String.format("Tried to delete non-local Sone: %s", sone)); + return; } + // FIXME – implement in database +// sones.remove(sone.getId()); + SoneInserter soneInserter = soneInserters.remove(sone); + soneInserter.stop(); webOfTrustUpdater.removeContext((OwnIdentity) sone.getIdentity(), "Sone"); webOfTrustUpdater.removeProperty((OwnIdentity) sone.getIdentity(), "Sone.LatestEdition"); try { @@ -1141,37 +1077,24 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /* load images. */ - int imageCounter = 0; - while (true) { - String imagePrefix = sonePrefix + "/Images/" + imageCounter++; - String imageId = configuration.getStringValue(imagePrefix + "/ID").getValue(null); - if (imageId == null) { - break; - } - String albumId = configuration.getStringValue(imagePrefix + "/Album").getValue(null); - String key = configuration.getStringValue(imagePrefix + "/Key").getValue(null); - String title = configuration.getStringValue(imagePrefix + "/Title").getValue(null); - String description = configuration.getStringValue(imagePrefix + "/Description").getValue(null); - Long creationTime = configuration.getLongValue(imagePrefix + "/CreationTime").getValue(null); - Integer width = configuration.getIntValue(imagePrefix + "/Width").getValue(null); - Integer height = configuration.getIntValue(imagePrefix + "/Height").getValue(null); - if ((albumId == null) || (key == null) || (title == null) || (description == null) || (creationTime == null) || (width == null) || (height == null)) { - logger.log(Level.WARNING, "Invalid image found, aborting load!"); - return; - } - Album album = getAlbum(albumId); - if (album == null) { - logger.log(Level.WARNING, "Invalid album image encountered, aborting load!"); - return; - } - Image image = getImage(imageId).modify().setSone(sone).setCreationTime(creationTime).setKey(key).setTitle(title).setDescription(description).setWidth(width).setHeight(height).update(); - album.addImage(image); + try { + configurationSoneParser.parseImages(database); + } catch (InvalidImageFound iif) { + logger.log(WARNING, "Invalid image found, aborting load!"); + return; + } catch (InvalidParentAlbumFound ipaf) { + logger.log(Level.WARNING, + format("Invalid album image (%s) encountered, aborting load!", + ipaf.getAlbumParentId())); + return; } /* load avatar. */ String avatarId = configuration.getStringValue(sonePrefix + "/Profile/Avatar").getValue(null); if (avatarId != null) { - profile.setAvatar(getImage(avatarId, false)); + final Map images = + configurationSoneParser.getImages(); + profile.setAvatar(images.get(avatarId)); } /* load options. */ @@ -1199,18 +1122,19 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, for (Album album : topLevelAlbums) { sone.getRootAlbum().addAlbum(album); } - soneInserters.get(sone).setLastInsertFingerprint(lastInsertFingerprint); + database.storeSone(sone); + synchronized (soneInserters) { + soneInserters.get(sone).setLastInsertFingerprint(lastInsertFingerprint); + } } synchronized (knownSones) { for (String friend : friends) { knownSones.add(friend); } } - database.storePosts(sone, posts); for (Post post : posts) { post.setKnown(true); } - database.storePostReplies(sone, replies); for (PostReply reply : replies) { reply.setKnown(true); } @@ -1561,10 +1485,10 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, @Override public void serviceStop() { localElementTicker.shutdownNow(); - synchronized (sones) { + synchronized (soneInserters) { for (Entry soneInserter : soneInserters.entrySet()) { soneInserter.getValue().stop(); - saveSone(getLocalSone(soneInserter.getKey().getId(), false)); + saveSone(soneInserter.getKey()); } } saveConfiguration(); @@ -1796,7 +1720,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, */ private void loadConfiguration() { /* create options. */ - options.addIntegerOption("InsertionDelay", new DefaultOption(60, new IntegerRangePredicate(0, Integer.MAX_VALUE), new SetInsertionDelay())); + options.addIntegerOption("InsertionDelay", new DefaultOption(60, new IntegerRangePredicate(0, Integer.MAX_VALUE))); options.addIntegerOption("PostsPerPage", new DefaultOption(10, new IntegerRangePredicate(1, Integer.MAX_VALUE))); options.addIntegerOption("ImagesPerPage", new DefaultOption(9, new IntegerRangePredicate(1, Integer.MAX_VALUE))); options.addIntegerOption("CharactersPerPost", new DefaultOption(400, Predicates. or(new IntegerRangePredicate(50, Integer.MAX_VALUE), Predicates.equalTo(-1)))); @@ -1805,8 +1729,8 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, options.addIntegerOption("PositiveTrust", new DefaultOption(75, new IntegerRangePredicate(0, 100))); options.addIntegerOption("NegativeTrust", new DefaultOption(-25, new IntegerRangePredicate(-100, 100))); options.addStringOption("TrustComment", new DefaultOption("Set from Sone Web Interface")); - options.addBooleanOption("ActivateFcpInterface", new DefaultOption(false, fcpInterface.new SetActive())); - options.addIntegerOption("FcpFullAccessRequired", new DefaultOption(2, fcpInterface.new SetFullAccessRequired())); + options.addBooleanOption("ActivateFcpInterface", new DefaultOption(false)); + options.addIntegerOption("FcpFullAccessRequired", new DefaultOption(2)); loadConfigurationValue("InsertionDelay"); loadConfigurationValue("PostsPerPage"); @@ -1926,11 +1850,10 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, @Subscribe public void identityUpdated(IdentityUpdatedEvent identityUpdatedEvent) { Identity identity = identityUpdatedEvent.identity(); - final Sone sone = getRemoteSone(identity.getId(), false); + final Sone sone = getRemoteSone(identity.getId()); if (sone.isLocal()) { return; } - sone.setIdentity(identity); sone.setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), sone.getLatestEdition())); soneDownloader.addSone(sone); soneDownloaders.execute(soneDownloader.fetchSoneAction(sone)); @@ -1947,19 +1870,14 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, OwnIdentity ownIdentity = identityRemovedEvent.ownIdentity(); Identity identity = identityRemovedEvent.identity(); trustedIdentities.remove(ownIdentity, identity); - boolean foundIdentity = false; for (Entry> trustedIdentity : trustedIdentities.asMap().entrySet()) { if (trustedIdentity.getKey().equals(ownIdentity)) { continue; } if (trustedIdentity.getValue().contains(identity)) { - foundIdentity = true; + return; } } - if (foundIdentity) { - /* some local identity still trusts this identity, don’t remove. */ - return; - } Optional sone = getSone(identity.getId()); if (!sone.isPresent()) { /* TODO - we don’t have the Sone anymore. should this happen? */ @@ -1973,9 +1891,8 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, for (PostReply reply : sone.get().getReplies()) { eventBus.post(new PostReplyRemovedEvent(reply)); } - synchronized (sones) { - sones.remove(identity.getId()); - } +// TODO – implement in database +// sones.remove(identity.getId()); eventBus.post(new SoneRemovedEvent(sone.get())); }