From: David ‘Bombe’ Roden Date: Sun, 21 Sep 2014 10:26:21 +0000 (+0200) Subject: Use database methods where possible. X-Git-Tag: 0.9-rc1^2~3^2~108 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=563df6d3fb70d83ee8a7d2ee6b957434af7d3251;p=Sone.git Use database methods where possible. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 47a77ee..d60bbda 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -346,9 +346,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, */ @Override public Collection getSones() { - synchronized (sones) { - return ImmutableSet.copyOf(sones.values()); - } + return database.getSones(); } /** @@ -362,9 +360,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); } /** @@ -372,9 +368,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(); } /** @@ -407,9 +401,7 @@ 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(); } /**