1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

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

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;