Package javax.transaction

Examples of javax.transaction.TransactionManager.suspend()


      InitialContext ctx = new InitialContext();

      TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
      DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
     
      javax.transaction.Transaction txOld = mgr.suspend();
      mgr.begin();
     
      java.sql.Connection conn = null;
     
      PreparedStatement ps = null;
View Full Code Here


                    }
                    manager.begin();
                    m_owned.put(Thread.currentThread(), manager.getTransaction());
                } else {
                    if (suspended == null) {
                        suspended = manager.suspend();
                        if (timeout > 0) {
                            manager.setTransactionTimeout(timeout);
                        }
                        manager.begin();
                        m_owned.put(Thread.currentThread(), manager.getTransaction());
View Full Code Here

            return store.getConnection();
        else if (suspendInJTA()) {
            try {
                TransactionManager tm = getConfiguration()
                    .getManagedRuntimeInstance().getTransactionManager();
                _outerTransaction = tm.suspend();
                tm.begin();
                return store.getConnection();
            } catch (Exception e) {
                throw new StoreException(e);
            }
View Full Code Here

            if (TransactionUtil.getStatus() != STATUS_NO_TRANSACTION) {
                TransactionManager txMgr = TransactionFactory.getTransactionManager();
                if (txMgr != null) {
                    pushTransactionBeginStackSave(clearTransactionBeginStack());
                    pushSetRollbackOnlyCauseSave(clearSetRollbackOnlyCause());
                    Transaction trans = txMgr.suspend();
                    pushSuspendedTransaction(trans);
                    return trans;
                } else {
                    return null;
                }
View Full Code Here

      //let's put some values
      atomicMap.put("k1", "v1");

      tm.begin();
      AssertJUnit.assertEquals("v1", atomicMap.get("k1"));
      final Transaction tx1 = tm.suspend();

      tm.begin();
      AssertJUnit.assertEquals("v1", atomicMap.get("k1"));
      final Transaction tx2 = tm.suspend();
View Full Code Here

      AssertJUnit.assertEquals("v1", atomicMap.get("k1"));
      final Transaction tx1 = tm.suspend();

      tm.begin();
      AssertJUnit.assertEquals("v1", atomicMap.get("k1"));
      final Transaction tx2 = tm.suspend();

      tm.resume(tx1);
      atomicMap.put("k1", "v2");
      tm.commit();
View Full Code Here

      assert c2.get("k").equals("v");

      TransactionManager tm = TestingUtil.getTransactionManager(c1);
      tm.begin();
      c1.getAdvancedCache().lock("k");
      tm.suspend();

      // test that both c1 and c2 have locked k
      assertLocked(c1, "k");
      assertLocked(c2, "k");
View Full Code Here

      assert c1.get("c1key").equals("c1value_new");
      assert c1Replica.get("c1key").equals("c1value");
      assert c2.get("c2key").equals("c2value_new");
      assert c2Replica.get("c2key").equals("c2value");

      Transaction tx = tm.suspend();


      assertInitialValues(c1, c1Replica, c2, c2Replica);

      tm.resume(tx);
View Full Code Here

      assert c1.get("c1key").equals("c1value_new");
      assert c1Replica.get("c1key").equals("c1value");
      assert c2.get("c2key").equals("c2value_new");
      assert c2Replica.get("c2key").equals("c2value");

      Transaction tx = tm.suspend();

      assert c1.get("c1key").equals("c1value");
      assert c1Replica.get("c1key").equals("c1value");
      assert c2.get("c2key").equals("c2value");
      assert c2Replica.get("c2key").equals("c2value");
View Full Code Here

      // tx2
      tm2.begin();
      Map<String, String> readMap = createAtomicMap(cache2, "repeatableReadMap", false);
      assertMap(initialMap, readMap);
      Transaction tx2 = tm2.suspend();

      // tx3
      tm1.begin();
      writeMap.put("k1", "v1");
      writeMap.put("k2", "v2");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.