Package javax.transaction

Examples of javax.transaction.UserTransaction.commit()


        // check we rolled back the state changes from the 3rd insert
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.fireAllRules();
        ut.commit();
        assertEquals( 2,
                      list.size() );

        // insert and commit
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
View Full Code Here


        // insert and commit
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.insert( 3 );
        ksession.insert( 4 );
        ut.commit();

        // rollback again, this is testing that we can do consecutive rollbacks and commits without issue
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.insert( 5 );
View Full Code Here

       
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.insert( 7 );
        ksession.insert( 8 );
        ut.commit();

        ksession.fireAllRules();

        assertEquals( 6,
                      list.size() );
View Full Code Here

            out.println("WR1 sees " + thisIsWhatTx1Sees + "<br>");
            System.out.println("WR1 sees " + thisIsWhatTx1Sees);
            out.println("WR2 sees this before commit" + thisIsWhatTx2Sees + "<br>");
            System.out.println("WR2 sees this before commit " + thisIsWhatTx2Sees);

            tx.commit();
           
            thisIsWhatTx2Sees = wr2.getMethodDataAsString(HOST+"/file1");
            out.println("WR2 sees this after commit " + thisIsWhatTx2Sees + "<br>");
            System.out.println("WR2 sees this after commit " + thisIsWhatTx2Sees);
           
View Full Code Here

            log.warn("begin");
            tx.begin();
            log.warn("put");
            srcCache.put("/Node", Boolean.FALSE, Boolean.TRUE);
            log.warn("commit");
            tx.commit();
            log.warn("leave");
         }
         catch (Exception e)
         {
            log.error("caught exception " + e, e);
View Full Code Here

                     {
                     }
                     return;
                  }
               }
               tx.commit();
               if (checkAndSetState())
               {
                  return;
               }
               time = System.currentTimeMillis() - time;
View Full Code Here

                     dst++;
               }

               tx.begin();
               HashMap<Object, Integer> accounts = getAccounts();// read lock on NODE
               tx.commit();// releases read lock

               int sum = sumAccounts(accounts);
               log(anz + ": " + accounts + " Summe: " + sum);
               // the sum of all accounts always has to be 3000
               if (sum != 3000)
View Full Code Here

               try
               {
                  tx.begin();
                  deposit(customer[src], customer[dst], amo, tx);// gets write lock
                  tx.commit();// releases write lock
                  again = false;
               }
               catch (TimeoutException timeout_ex)
               {
                  System.out.println("transaction is rolled back, will try again (ex=" + timeout_ex.getClass() + ")");
View Full Code Here

     */
    @Test
    public void testEmptyTxCommit() throws Exception {
        final UserTransaction userTransaction = EJBClient.getUserTransaction(nodeName);
        userTransaction.begin();
        userTransaction.commit();
    }

    /**
     * Tests a empty begin()/rollback()
     *
 
View Full Code Here

        final CMTRemote cmtRemoteBean = EJBClient.createProxy(cmtRemoteBeanLocator);

        final UserTransaction userTransaction = EJBClient.getUserTransaction(nodeName);
        userTransaction.begin();
        cmtRemoteBean.mandatoryTxOp();
        userTransaction.commit();
    }

    /**
     * Tests various possibilities with a user initiated UserTransaction and subsequent bean invocations
     *
 
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.