[jboss-jira] [JBoss JIRA] (JGRP-1979) org.jgroups.blocks.Cache.get() method always evicts values because it does not check Value.insertion_time

Ben Johnson (JIRA) issues at jboss.org
Mon Nov 16 08:55:00 EST 2015


     [ https://issues.jboss.org/browse/JGRP-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben Johnson reopened JGRP-1979:
-------------------------------


Hi Bela

I just discovered a bug with my fix - get() now returns the value even if it is expired, whereas before it returned null.  I've fixed this, and also written a more comprehensive set of unit tests for Cache.java as well.  Note that I changed the 'change_listeners' variable from a HashSet to LinkedHashSet to simplify testing of the listener logic.

Ben

> 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, 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)



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list