Hello!

I tried to use the map.LRUMap but failed by a design issue.

Copied from the test-case:

MockLRUMapSubclassBlocksRemove map = new MockLRUMapSubclassBlocksRemove(2);
assertEquals(0, map.size());
map.put("A", "a");
assertEquals(1, map.size());
map.put("B", "b");
assertEquals(2, map.size());
map.put("C", "c"); // should remove oldest, which is A=a, but this is blocked
assertEquals(3, map.size());
assertEquals(2, map.maxSize());
assertEquals(true, map.containsKey("A"));
assertEquals(true, map.containsKey("B"));
assertEquals(true, map.containsKey("C"));


The interesting part is "map.put("C", "c"); //* should remove oldest, which is A=a, but this is blocked*".
Even it the current test-case do not handle it (it blocks all entries), but shouldnt the LRUMap - if an entry is locked - search the next removeable entry?
At the end, the entries "A" and "C" should be in the map - only if all entries are lock the map should grow.


I cant derive from LRUMap to overload addMapping - The members "before" and "after" on LinkEntry are protected and not accessible by the subclass.


-- Mario

Reply via email to