From 563df6d3fb70d83ee8a7d2ee6b957434af7d3251 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 21 Sep 2014 12:26:21 +0200 Subject: [PATCH] Use database methods where possible. --- src/main/java/net/pterodactylus/sone/core/Core.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) 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(); } /** -- 2.7.4