Make Roster's non-roster presence second-level map bounded

Fixes SMACK-809.
This commit is contained in:
Florian Schmaus 2018-03-09 16:00:18 +01:00
parent 1d438ec1c2
commit 1fd03c396a
1 changed files with 4 additions and 2 deletions

View File

@ -382,12 +382,14 @@ public final class Roster extends Manager {
private synchronized Map<Resourcepart, Presence> getOrCreatePresencesInternal(BareJid entity) {
Map<Resourcepart, Presence> entityPresences = getPresencesInternal(entity);
if (entityPresences == null) {
entityPresences = new ConcurrentHashMap<>();
if (contains(entity)) {
entityPresences = new ConcurrentHashMap<>();
presenceMap.put(entity, entityPresences);
}
else {
nonRosterPresenceMap.put(entity, entityPresences);
LruCache<Resourcepart, Presence> nonRosterEntityPresences = new LruCache<>(32);
nonRosterPresenceMap.put(entity, nonRosterEntityPresences);
entityPresences = nonRosterEntityPresences;
}
}
return entityPresences;