Merge pull request #1186 from nevesmarcio/2.x_memleak_only

Memory leak fix in the subscribers cache
This commit is contained in:
Julien Viet
2018-04-16 11:30:25 +02:00
committed by GitHub

View File

@@ -114,11 +114,15 @@ class HazelcastAsyncMultiMap<K, V> implements AsyncMultiMap<K, V>, EntryListener
} else {
sids = new ChoosableSet<>(0);
}
ChoosableSet<V> prev = cache.putIfAbsent(k, sids);
if (prev != null) {
// Merge them
prev.merge(sids);
sids = prev;
//SBKD-322 Quick fix for memory leak that has been caused by adding to subscribers cache
//empty sets. When no subscribers are present just omit caching it.
if (!sids.isEmpty()) {
ChoosableSet<V> prev = cache.putIfAbsent(k, sids);
if (prev != null) {
// Merge them
prev.merge(sids);
sids = prev;
}
}
sids.setInitialised();
sresult.setResult(sids);