[jboss-user] [JBoss Cache: Core Edition] - Removing non-existing key causes losing of other entry

AlexFu.Novell do-not-reply at jboss.com
Mon Feb 9 18:54:58 EST 2009


Here is a very small standalone program compiled and executed using 3.0.2. What it does are:
(0) create and start a Cache with no customization at all;
(1) put a key/value pair in a Node; 
(2) remove a non-existing key from the same Node;
(3) try to retrieve the value stored in step (1). It's null.

If I have more than 1 entry before calling remove() then everything is fine.

Also played with some eviction settings with big minTimeToLive value but still got the same result. 

It's very suspicious... Seems like a serious bug.  


import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;


public class TestCache
{
    public static void main(String[] argv)
    {
        Cache cc = new DefaultCacheFactory().createCache();
        
        cc.put("/test", "key1", "value1");
        System.out.println("Size of cache " + cc.getKeys("/test").size());
        Object r = cc.remove("/test", "key2");
        System.out.println("What is removed " + r);
        System.out.println("Size of cache " + cc.getKeys("/test").size());
        Object o = cc.get("/test", "key1");
        System.out.println("O is " + o);
    }
}


Result:

Size of cache 1
What is removed null
Size of cache 0
O is null



Thanks,
-Alex

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4208318#4208318

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4208318



More information about the jboss-user mailing list