2 Replies Latest reply on Feb 4, 2011 10:27 AM by sudheerk84

    Cache replication happens across cluster even on transaction failure for POJO objects in cache

    sudheerk84

      My transaction behaviour with POJOS work fine within a VM. But in a clustered mode dirty values(pojo updates before tarnsaction commits) are propagated across cluster. I have the following piece od code to demonstare the same

       

      i use the default isolation mode that is READ_COMMITED.(i have also pasted the cache configurations below)

       

       

      Any help in solving this is really appreciated :-)

       

      I have the follwing piece of code in VM1

       

      Cache values before this loop starts -   ["key1" - > POJO MyDVO(int value -> 369) ] ,  [ "key2","dan"]

       

       

         System.out.println(":  before transaction: "  + ((MyDVO) cache.get("key1")).getValue());

         System.out.println(":  before transaction: " + cache.get("key2"));

       

              userTransactionManager.begin();       

       

              MyDVO dvo = (MyDVO) cache.get("key1");
              dvo.setValue(r.nextInt(1000));
              cache.put("key2", "bob");

       

              userTransactionManager.rollback();

       

      After the rolback  i get teh old values printed - since the transaction was rolled back.

       

      But in Vm2 when i print teh values for key1 and key2

       

      key2 value ("dan") - String - is fine .  [Sicen transaction was rolled back - change "bob" is not shown]

       

      key1 value (int value inside POJO) - shows teh updated value even though transaction is rolled back.

       

      I use same cache configuration in Vm1 and in VM2 and is as follows

       

       

               <namedCache name="orderCache">
                    <clustering mode="distribution">
                               <l1
                      enabled="false"
                  />
                        <sync/>
                        <hash
                           numOwners="1"
                           rehashWait="120000"
                           rehashRpcTimeout="600000"
                        />
                     </clustering>
               </namedCache>

       

       

      Default and global sectiosn are as follows

       

         <global>


             <transport
                  clusterName="tspexCluster">
               <properties>
                  <property name="configurationFile" value="jgroups-tcp.xml" />
               </properties>
            </transport>
           
          

         </global>


         <default>

            <jmxStatistics enabled="true"/>
           <transaction transactionManagerLookupClass="com.myconpamy.poc.cache.TransactionManagerLookup"
                              syncRollbackPhase="false"
                              syncCommitPhase="false"
            useEagerLocking="false"/>  

            <clustering mode="replication">

               <stateRetrieval
                  timeout="20000"
                  fetchInMemoryState="false"
                  alwaysProvideInMemoryState="false"
               />

               <sync replTimeout="20000"/>

            </clustering>
       
        </default>

       

       

       

      Is there any error in my configurations ?

       

       

      PS - I am using atomikos transaction manager.