[jboss-user] [JBossCache] - Data integrity in a clustered jboss cache

itchy75 do-not-reply at jboss.com
Mon Aug 6 10:13:50 EDT 2007


Hello,

Im' using JBoss Cache (tree cache) in a cluster environment. I try to do the following tings : 

1. get a value from the cache = get(Fqn, key)
2. modify this value
3. put the value in cache  = put(Fqn, key, value)

I use SERIALIZABLE isolation level and PESSIMISTIC lock.

The problem is when two programs running on differents servers modify the value at the same time. 


  | Server 1                              Server 2
  | x = getvalue();                           
  | x++                                   x =getValue();
  | put x in cache                        x++ 
  |                                       put xin cache  
  | 

If the value was bound to 0, it should be 2 at the end (serializable) but x=1 at the end of the execution.

The questions are :

- How could I serialize an operation in a clustered cache (ie reading/modify/persist a value in cache) ? I try to manage the transaction myself with transaction manager but it doesn't work.

- I also understood from documentation that SERIALIZABLE isolation level lock the node when you read or write value in the cache. I am using jboss cache in a spring context and no transaction attributes are defined. In this case, when the transaction is initialized/commited if I use SERIALIZABLE is used ?

- Is it possible to use spring to declare a cache transaction on classes' method ?

Thanks a lot.










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

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



More information about the jboss-user mailing list