Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ConcurrentLinkedHashMap as backing for LRUMap #3531

Merged
merged 41 commits into from
Jul 1, 2022
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
dd7a597
use ConcurrentLinkedHashMap as backing for LRUMap
pjfanning Jun 26, 2022
cd4e033
move new package
pjfanning Jun 26, 2022
47e9ae3
remove new jar dependency (jsr 305) - use apache cayenne version of CLHM
pjfanning Jun 26, 2022
8befa70
Create ConcurrentLinkedHashMapTest.java
pjfanning Jun 27, 2022
8f1bdcd
Create LRUMapTest.java
pjfanning Jun 27, 2022
0ae71ae
move serialization test so that internal state can be checked
pjfanning Jun 27, 2022
7d901fb
Update TestJDKSerialization.java
pjfanning Jun 27, 2022
111f3b3
Update LRUMapTest.java
pjfanning Jun 27, 2022
bfc5302
extra tests - some fail and will be investigated in coming days
pjfanning Jun 27, 2022
3882f17
prevent add being used on the map entrySet
pjfanning Jun 27, 2022
b2c9b08
Create ConcurrentLinkedHashMapStressTest.java
pjfanning Jun 28, 2022
0c01d2b
Update ConcurrentLinkedHashMapStressTest.java
pjfanning Jun 28, 2022
674a407
wip
pjfanning Jun 28, 2022
53c3205
try to make test reliable
pjfanning Jun 28, 2022
f246b9c
Merge pull request #2 from pjfanning/stress2
pjfanning Jun 28, 2022
bac364a
Update ConcurrentLinkedHashMapStressTest.java
pjfanning Jun 28, 2022
517f432
Update ConcurrentLinkedHashMapStressTest.java
pjfanning Jun 28, 2022
c57d7e1
Update ConcurrentLinkedHashMapStressTest.java
pjfanning Jun 28, 2022
6936cd9
rename package
pjfanning Jun 28, 2022
669a562
Create package-info.java
pjfanning Jun 28, 2022
f145f0a
remove some unused weigher implementations
pjfanning Jun 28, 2022
946549a
stop using apache cayenne version and use latest Ben Mane's code agai…
pjfanning Jun 28, 2022
47a1bb1
Update ConcurrentLinkedHashMapStressTest.java
pjfanning Jun 28, 2022
8463041
Update ConcurrentLinkedHashMapStressTest.java
pjfanning Jun 28, 2022
64bd51f
see if updating clhm and map as an atomic operation helps to make tes…
pjfanning Jun 28, 2022
f916019
Update ConcurrentLinkedHashMapStressTest.java
pjfanning Jun 28, 2022
1696ac0
remove unnecessary concurrency level
pjfanning Jun 29, 2022
8d29de8
remove more code for concurrency level
pjfanning Jun 29, 2022
a5581f7
make this CLHM non-serializable
pjfanning Jun 30, 2022
8e6897d
remove EvictionListener
pjfanning Jun 30, 2022
6a5a5b2
Revert "remove EvictionListener"
pjfanning Jun 30, 2022
4a26b39
Revert "make this CLHM non-serializable"
pjfanning Jun 30, 2022
2e132ca
Revert "remove more code for concurrency level"
pjfanning Jun 30, 2022
dfcf976
Revert "remove unnecessary concurrency level"
pjfanning Jun 30, 2022
fc6fa05
Update package-info.java
pjfanning Jun 30, 2022
6820db2
make some more classes package private
pjfanning Jun 30, 2022
ff39d5f
rename internal map
pjfanning Jun 30, 2022
b438091
remove more weigher logic
pjfanning Jun 30, 2022
f85c808
Update LRUMap.java
pjfanning Jun 30, 2022
3bc8acd
remove Weigher interface
pjfanning Jul 1, 2022
a0e8839
remove EntryWeigher interface
pjfanning Jul 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public void testManyEntries() throws Exception {
final int maxEntries = 30;
final int maxKey = 100;
final Random rnd = new Random();
//final com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap<Integer, UUID> clhm =
// new com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.Builder<Integer, UUID>().maximumWeightedCapacity(maxEntries).build();
final ConcurrentLinkedHashMap<Integer, UUID> clhm =
new ConcurrentLinkedHashMap.Builder<Integer, UUID>().maximumWeightedCapacity(maxEntries).build();
final Map<Integer, UUID> map = new ConcurrentHashMap<>();
Expand All @@ -53,8 +51,9 @@ public void testManyEntries() throws Exception {
executor.shutdown();
}
executor.awaitTermination(waitSeconds, TimeUnit.SECONDS);
//clhm.executor.shutdown();
//clhm.executor.awaitTermination(waitSeconds, TimeUnit.SECONDS);

//ConcurrentLinkedHashMap runs evictions in the background using its own ExecutorService
//the following code retries the assertions to allow for the evictions to finish
pjfanning marked this conversation as resolved.
Show resolved Hide resolved
final long endTime = System.nanoTime() + Duration.of(waitSeconds, ChronoUnit.SECONDS).toNanos();
boolean assertsFailing = true;
while(assertsFailing) {
Expand Down