Package com.arjuna.mw.wst

Examples of com.arjuna.mw.wst.UserTransaction


{

    public static void testSubTransactionRollback()
            throws Exception
    {
        final UserTransaction ut = UserTransactionFactory.userTransaction();
        final UserTransaction ust = UserTransactionFactory.userSubordinateTransaction();
        final TransactionManager tm = TransactionManager.getTransactionManager();

        final DemoDurableParticipant p1 = new DemoDurableParticipant();
        final DemoVolatileParticipant p2 = new DemoVolatileParticipant();
        final DemoDurableParticipant p3 = new DemoDurableParticipant();
        final DemoVolatileParticipant p4 = new DemoVolatileParticipant();

        ut.begin();
        final TxContext tx = tm.suspend();
        tm.resume(tx);
        tm.enlistForDurableTwoPhase(p1, p1.identifier());
        tm.enlistForVolatileTwoPhase(p2, p2.identifier());
        ust.begin();
        final TxContext stx = tm.suspend();
        tm.resume(stx);
        tm.enlistForDurableTwoPhase(p3, p3.identifier());
        tm.enlistForVolatileTwoPhase(p4, p4.identifier());
View Full Code Here


{

    public static void testSynchronizationParticipant()
            throws Exception
    {
      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
      DemoDurableParticipant p = new DemoDurableParticipant();
      DemoVolatileParticipant pz = new DemoVolatileParticipant();
     
      ut.begin();
    try {
      tm.enlistForDurableTwoPhase(p, p.identifier());
      tm.enlistForVolatileTwoPhase(pz, pz.identifier());
    catch (Exception eouter) {
        try {
            ut.rollback();
        } catch(Exception einner) {
        }
        throw eouter;
    }
      ut.commit();
    }
View Full Code Here

     */
    private void testAtomicTransaction(int restaurantSeats, int theatreSeats, int theatreArea, boolean bookTaxi) throws Exception
    {
        System.out.println("CLIENT: obtaining userTransaction...");

        UserTransaction ut = UserTransactionFactory.userTransaction();

        System.out.println("CLIENT: starting the transaction...");

        ut.begin();

        System.out.println("CLIENT: transaction ID= " + ut.toString());

        System.out.println("CLIENT: calling business Web Services...");

        restaurantAT.bookSeats(restaurantSeats);
        theatreAT.bookSeats(theatreSeats, theatreArea);
        if (bookTaxi)
        {
            taxiAT.bookTaxi();
        }

        System.out.println("CLIENT: calling commit on the transaction...");

        ut.commit();

        System.out.println("done.");
        System.out.flush();
    }
View Full Code Here

    {
  boolean passed = false;
 
  try
  {
      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
      DemoDurableParticipant p = new DemoDurableParticipant();
     
      ut.begin();
     
      tm.enlistForDurableTwoPhase(p, null);
     
      ut.commit();

      passed = p.passed();
  }
  catch (Exception ex)
  {
View Full Code Here

    {
  boolean passed = false;
 
  try
  {
      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
      FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_COMMIT, FailureParticipant.WRONG_STATE);
      DemoDurableParticipant p2 = new DemoDurableParticipant();
     
      ut.begin();
     
      tm.enlistForDurableTwoPhase(p1, null);
      tm.enlistForDurableTwoPhase(p2, null);
     
      ut.commit();

      passed = false;
  }
  catch (com.arjuna.wst.SystemException ex)
  {
View Full Code Here

    {
  boolean passed = false;
 
  try
  {
      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
 
      ut.begin();
     
      TxContext ctx = tm.suspend();

      System.out.println("Suspended: "+ctx);
     
View Full Code Here

    {
  boolean passed = false;
 
  try
  {
      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
      FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_PREPARE, FailureParticipant.WRONG_STATE);
      DemoDurableParticipant p2 = new DemoDurableParticipant();
     
      ut.begin();
     
      tm.enlistForDurableTwoPhase(p1, null);
      tm.enlistForDurableTwoPhase(p2, null);
     
      ut.commit();

      passed = false;
  }
  catch (com.arjuna.wst.SystemException ex)
  {
View Full Code Here

    {
  boolean passed = false;
 
  try
  {
      UserTransaction ut = UserTransaction.getUserTransaction();
 
      ut.begin();

      System.out.println("Started: "+ut);
     
      ut.commit();

      System.out.println("\nCurrent: "+ut);
     
      passed = true;
  }
View Full Code Here

    {
  boolean passed = false;
 
  try
  {
      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
      FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_ROLLBACK, FailureParticipant.WRONG_STATE);
      DemoDurableParticipant p2 = new DemoDurableParticipant();
     
      ut.begin();
     
      tm.enlistForDurableTwoPhase(p1, null);
      tm.enlistForDurableTwoPhase(p2, null);
     
      ut.rollback();

      passed = true;
  }
  catch (Exception ex)
  {
View Full Code Here

     */
    private void testAtomicTransaction(int restaurantSeats, int theatreSeats, int theatreArea, boolean bookTaxi) throws Exception
    {
        System.out.println("CLIENT: obtaining userTransaction...");

        UserTransaction ut = UserTransactionFactory.userTransaction();

        System.out.println("CLIENT: starting the transaction...");

        ut.begin();

        System.out.println("CLIENT: transaction ID= " + ut.toString());

        System.out.println("CLIENT: calling business Web Services...");

        restaurantAT.bookSeats(restaurantSeats);
        theatreAT.bookSeats(theatreSeats, theatreArea);
        if (bookTaxi)
        {
            taxiAT.bookTaxi();
        }

        System.out.println("CLIENT: calling commit on the transaction...");

        ut.commit();

        System.out.println("done.");
        System.out.flush();
    }
View Full Code Here

TOP

Related Classes of com.arjuna.mw.wst.UserTransaction

Copyright © 2018 www.massapicom. 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.