5 Replies Latest reply on Dec 14, 2006 12:30 PM by Manik Surtani

    Transactions problem

    sergey qwier Newbie

      Hi all,
      I am trying to figure out how to get transactions work with the cache.

      Please have a look at the following code snippet:

      InitialContext ic = new InitialContext();
      UserTransaction ut = (UserTransaction)ic.lookup("UserTransaction");
      ut.begin();
      Integer x = (Integer)cache.get("/Test","TestInteger");
      x = x+1;
      Thread.sleep(5000);
      cache.put("/Test", "TestInteger", x);
      ut.commit();
      


      This code is simultaneously running from two different JBoss instances within one cluster.
      How can I manage to get the x value increased by 2? Now it is increased by 1.

      Below are my cache settings related to transactions:
      TransactionManagerLookupClass=org.jboss.cache.DummyTransactionManagerLookup
      IsolationLevel=SERIALIZABLE (actually here I tried all of the possible values)
      CacheMode=REPL_SYNC
      NodeLockingScheme=PESSIMISTIC

      Thanks!