We are using jboss cache (Tree cache) to cache our objects in all our products.
We are facing a critical issue. After saving an object to the jboss cache
using put method and retrieving the object from jboss cache using get method
and changing the state of the object, the state of the object inside the jboss
cache is also getting modified. According to the jboss cache documentation the
state of the object inside the cache should not be modified until I call put
method.
I am forwarding a test case
Test Case
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jboss.cache.PropertyConfigurator;
import org.jboss.cache.TreeCache;
public class TestCache {
public static void main(String[] args) throws Exception{
List l1 = new ArrayList();
List l2 = new ArrayList();
l2.add("One");
l2.add("Two");
l2.add("Three");
l1.add(l2);
TreeCache jbossCache = null;
try {
jbossCache = new TreeCache();
PropertyConfigurator config = new PropertyConfigurator();
config.configure(jbossCache, "C:\\jboss_cache.xml");
jbossCache.startService();
}
catch(Exception ex) {
System.out.println(ex);
}
jbossCache.put("fqn", "ListInList", l1);
System.out .println("l1 : "+l1.hashCode());
List l3 = (List) jbossCache.get("fqn","ListInList");
System.out .println("l3 : "+l3.hashCode());
for (Iterator i = l3.iterator(); i.hasNext(); ){
List l4 = (List) i.next();
for (Iterator i1 = l4.iterator(); i1.hasNext(); ){
String str = (String) i1.next();
System.out .println(str);
}
}
List l5 = (List)l3.get(0);
l5.remove(1);
List l6 = (List) jbossCache.get("fqn","ListInList");
System.out .println("l6 : "+l6.hashCode());
for (Iterator i2 = l6.iterator(); i2.hasNext(); ){
List l7 = (List) i2.next();
for (Iterator i3 = l7.iterator(); i3.hasNext(); ){
String str = (String) i3.next();
System.out .println(str);
}
}
}
}
Configuration File
-
jboss:service=Naming
jboss:service=TransactionManager
org.jboss.cache.GenericTransactionManagerLookup
PESSIMISTIC
READ_COMMITTED
REPL_SYNC
false
0
0
@cache_cluster_name@
true
2
2
150
org.jboss.cache.eviction.LRUPolicy
5
5000
1000
5000
1000
5
4
false
Can you please give us any solution / suggestion?
--Rahul
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163686#4163686
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163686
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user