INT-2030 finished with initial implementation fo Redis-based MessageGroupStore

This commit is contained in:
Oleg Zhurakousky
2011-08-11 09:53:44 -04:00
parent 28bcb4bfcf
commit 94dea0855d
4 changed files with 58 additions and 3 deletions

View File

@@ -45,6 +45,9 @@ class RedisMessageGroup implements MessageGroup {
this.groupId = groupId;
this.redisTemplate = redisTemplate;
this.messageStore = messageStore;
BoundListOperations<String, Object> unmarkedOps = this.redisTemplate.boundListOps(UNMARKED_PREFIX + this.groupId.toString());
BoundListOperations<String, Object> markedOps = this.redisTemplate.boundListOps(MARKED_PREFIX + this.groupId.toString());
this.rebuildLocalCache(unmarkedOps, markedOps);
}
public boolean canAdd(Message<?> message) {
@@ -231,7 +234,6 @@ class RedisMessageGroup implements MessageGroup {
private void rebuildLocalCache(BoundListOperations<String, Object> unmarkedOps, BoundListOperations<String, Object> markedOps){
if (unmarkedOps != null){
this.unmarked.clear();
this.unmarked.addAll(this.buildMessageList(unmarkedOps));

View File

@@ -156,9 +156,9 @@ public class RedisMessageStore extends AbstractMessageGroupStore implements Mess
BoundSetOperations<String, Object> mGroupsOps = this.redisTemplate.boundSetOps(MESSAGE_GROUPS_KEY);
if (!mGroupsOps.isMember(groupId)){
mGroupsOps.add(groupId);
group = new RedisMessageGroup(this, this.redisTemplate, groupId);
this.messageGroups.put(groupId, group);
}
group = new RedisMessageGroup(this, this.redisTemplate, groupId);
this.messageGroups.put(groupId, group);
}
}