-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISPN-11209 Max Idle changes caused a REPL read performance regression
* Make sure to not calculate segment if segmentation is disabled * Add in interface to prevent additional if/else blocks
- Loading branch information
1 parent
dbd6934
commit b2f78bb
Showing
12 changed files
with
117 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
core/src/main/java/org/infinispan/container/impl/PeekableTouchableContainerMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.infinispan.container.impl; | ||
|
||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.ConcurrentMap; | ||
|
||
import org.infinispan.commons.util.AbstractDelegatingConcurrentMap; | ||
import org.infinispan.container.entries.InternalCacheEntry; | ||
|
||
public class PeekableTouchableContainerMap<K, V> extends AbstractDelegatingConcurrentMap<K, InternalCacheEntry<K, V>> | ||
implements PeekableTouchableMap<K, InternalCacheEntry<K, V>> { | ||
private final ConcurrentMap<K, InternalCacheEntry<K, V>> map; | ||
|
||
public PeekableTouchableContainerMap() { | ||
this(new ConcurrentHashMap<>()); | ||
} | ||
|
||
public PeekableTouchableContainerMap(ConcurrentMap<K, InternalCacheEntry<K, V>> map) { | ||
this.map = map; | ||
} | ||
|
||
@Override | ||
protected ConcurrentMap<K, InternalCacheEntry<K, V>> delegate() { | ||
return map; | ||
} | ||
|
||
@Override | ||
public InternalCacheEntry<K, V> peek(Object key) { | ||
return delegate().get(key); | ||
} | ||
|
||
@Override | ||
public boolean touchKey(Object key, long currentTimeMillis) { | ||
InternalCacheEntry<K, V> ice = peek(key); | ||
if (ice != null) { | ||
ice.touch(currentTimeMillis); | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
core/src/main/java/org/infinispan/container/impl/PeekableTouchableMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.infinispan.container.impl; | ||
|
||
import java.util.concurrent.ConcurrentMap; | ||
|
||
import org.infinispan.commons.util.PeekableMap; | ||
|
||
public interface PeekableTouchableMap<K, V> extends PeekableMap<K, V>, TouchableMap, ConcurrentMap<K, V> { | ||
} |
12 changes: 12 additions & 0 deletions
12
core/src/main/java/org/infinispan/container/impl/TouchableMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.infinispan.container.impl; | ||
|
||
public interface TouchableMap { | ||
/** | ||
* Touches the entry for the given key in this map. This method will update any recency timestamps for both | ||
* expiration or eviction as needed. | ||
* @param key key to touch | ||
* @param currentTimeMillis the recency timestamp to set | ||
* @return whether the entry was touched or not | ||
*/ | ||
boolean touchKey(Object key, long currentTimeMillis); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.