Skip to content

Commit

Permalink
Bug 35512355 - [35510189->22.06.5] Performance issue introduced by EN…
Browse files Browse the repository at this point in the history
…H 32987434 - LocalCache's eviction iterator can be improved to remove the entry from the eviction list during traversal

BUG 35510189 - Performance issue introduced by ENH 32987434 - LocalCache's eviction iterator can be improved to remove the entry from the eviction list during traversal
- add ListIterator.set(null) call
(auto-submit 101259 after successfully running remote remote.full)
Job ID: job.9.20230620165024.5939
(auto-submit integ 101264 release/coherence-v14.1.1.2206 -> coherence-ce/release/coherence-ce-v22.06 after successfully running remote remote.full)
Job ID: job.9.20230620185637.22348

[git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v22.06/": change = 101274]
  • Loading branch information
fryp committed Jun 20, 2023
1 parent 881129b commit b8dcbcc
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;

import java.util.concurrent.atomic.AtomicBoolean;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

Expand Down Expand Up @@ -1861,7 +1863,7 @@ protected synchronized void prune()
// store off the list of pending evictions
if (listEvict != null)
{
m_iterEvict = listEvict.iterator();
m_iterEvict = listEvict.listIterator();
}

// make a first pass at the pending evictions
Expand Down Expand Up @@ -1915,7 +1917,7 @@ private int queueForEviction(Entry entry, List listEvict)
*/
private void pruneIncremental()
{
Iterator iterEvict = m_iterEvict;
ListIterator iterEvict = m_iterEvict;
if (iterEvict != null)
{
// pruning will proceed until the cache is down below the max
Expand All @@ -1927,7 +1929,7 @@ private void pruneIncremental()
{
Entry entry = (Entry) getEntryInternal(iterEvict.next());

// COH-27922 - consider adding iterEvict().set(null) which would require converting iterEvict to a ListIterator
iterEvict.set(null); // COH-27922 - release the reference to the entry so that it can be garbage collected
if (entry != null && entry.isEvictable() &&
removeEvicted(entry) &&
--cMinEntries <= 0 && m_cCurUnits < cMaxUnits)
Expand Down Expand Up @@ -2989,7 +2991,7 @@ public String getName()
* there are no entries with deferred eviction.
* @since Coherence 3.5
*/
protected Iterator m_iterEvict;
protected ListIterator m_iterEvict;

/**
* Specifies whether or not this cache will incrementally evict.
Expand Down

0 comments on commit b8dcbcc

Please sign in to comment.