code cleanup

This commit is contained in:
Athou
2014-08-14 11:40:30 +02:00
parent cda6cb5cc0
commit 1324269f1d
7 changed files with 16 additions and 53 deletions

View File

@@ -28,7 +28,7 @@ public class FeedSubscriptionService {
@SuppressWarnings("serial")
public static class FeedSubscriptionException extends RuntimeException {
public FeedSubscriptionException(String msg) {
private FeedSubscriptionException(String msg) {
super(msg);
}
}
@@ -87,16 +87,6 @@ public class FeedSubscriptionService {
}
}
public UnreadCount getUnreadCount(User user, FeedSubscription sub) {
UnreadCount count = cache.getUnreadCount(sub);
if (count == null) {
log.debug("unread count cache miss for {}", Models.getId(sub));
count = feedEntryStatusDAO.getUnreadCount(user, sub);
cache.setUnreadCount(sub, count);
}
return count;
}
public Map<Long, UnreadCount> getUnreadCount(User user) {
Map<Long, UnreadCount> map = Maps.newHashMap();
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
@@ -106,4 +96,14 @@ public class FeedSubscriptionService {
return map;
}
private UnreadCount getUnreadCount(User user, FeedSubscription sub) {
UnreadCount count = cache.getUnreadCount(sub);
if (count == null) {
log.debug("unread count cache miss for {}", Models.getId(sub));
count = feedEntryStatusDAO.getUnreadCount(user, sub);
cache.setUnreadCount(sub, count);
}
return count;
}
}