]
Bela Ban resolved JGRP-1979.
----------------------------
Resolution: Done
PR applied
org.jgroups.blocks.Cache.get() method always evicts values because it
does not check Value.insertion_time
---------------------------------------------------------------------------------------------------------
Key: JGRP-1979
URL:
https://issues.jboss.org/browse/JGRP-1979
Project: JGroups
Issue Type: Bug
Affects Versions: 3.6.1, 3.6.6
Environment: Windows 10 64-bit
Reporter: Ben Johnson
Assignee: Bela Ban
Priority: Minor
Fix For: 3.6.7
Attachments: Cache.java, Cache.java, CacheTest.java, CacheTest.java
org.jgroups.blocks.Cache.get(String key) always evicts the matching entry and returns a
value of null. It is doing this because the method is comparing the Value timeout
property against the current system time without using the Value's insertion_time
(unlike the evict() method, which does).
I have created a simple unit test to illustrate this and provided a fix (from the
3.6.1.Final code base, which doesn't include the diamond operator updates). I added a
couple of helper methods isExpired(Value val) and getValue(Value val)