Package com.arjuna.mw.wst11

Examples of com.arjuna.mw.wst11.UserTransaction


    public void run ()
    {
  try
  {
      UserTransaction ut = UserTransaction.getUserTransaction();

      ut.begin();

      System.out.println("Thread "+Thread.currentThread()+" started "+ut);

      Thread.yield();

      System.out.println("\nThread "+Thread.currentThread()+" committing "+ut);

      ut.commit();



      Thread.yield();
  }
View Full Code Here


{

    public static void testCommitRollbackInPrepare()
            throws Exception
    {
        UserTransaction ut = UserTransaction.getUserTransaction();
  try
  {
      TransactionManager tm = TransactionManager.getTransactionManager();
      FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_PREPARE, FailureParticipant.NONE);
      DemoDurableParticipant p2 = new DemoDurableParticipant();

      ut.begin();

      tm.enlistForDurableTwoPhase(p1, "failure");
      tm.enlistForDurableTwoPhase(p2, p2.identifier());
    catch (Exception eouter) {
        try {
            ut.rollback();
        } catch(Exception einner) {
        }
        throw eouter;
    }
  try {
      ut.commit();

      fail("expected TransactionRolledBackException");
  }
  catch (com.arjuna.wst.TransactionRolledBackException ex)
  {
View Full Code Here

{

    public static void testSubTransactionCommitRollbackInPrepare()
            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 FailureParticipant p3 = new FailureParticipant(FailureParticipant.FAIL_IN_PREPARE, FailureParticipant.NONE);
        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, "failure in prepare");
        tm.enlistForVolatileTwoPhase(p4, p4.identifier());
View Full Code Here

{

    public static void testNullRollbackTransaction()
            throws Exception
    {
      UserTransaction ut = UserTransaction.getUserTransaction();

      ut.begin();

      ut.rollback();
    }
View Full Code Here

{

    public static void testSuspendCommitTransaction()
            throws Exception
    {
        UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();

      ut.begin();

    try {
      TxContext ctx = tm.suspend();

      System.out.println("Suspended: "+ctx);
    catch (Exception eouter) {
        try {
            ut.rollback();
        } catch(Exception einner) {
        }
        throw eouter;
    }

    try {
      ut.commit();
  }
  catch (WrongStateException ex)
  {
      // we should arrive here
  }
View Full Code Here

{

    public static void testSubTransactionCommit()
            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

    @WebMethod
    public void order(@WebParam(name = "name") String name,
        @WebParam(name = "fltid") String fltid) {
        log.info("AirportService:order");

        UserTransaction transactionId = UserTransactionFactory
            .userTransaction();

        if (transactionId != null) {
            log.info("Transaction ID = " + transactionId.toString());
            if (transactionId.toString().compareTo("Unknown") == 0) {
                log.info("JBoss AS is badly configured. (Enable XTS)");
                return;
            }

            // Create order participant (fly ticket)
            OrderParticipant op = new OrderParticipant(
                transactionId.toString(), fltid);

            try {
                // Enlist order participant to the transaction
                TransactionManagerFactory.transactionManager()
                    .enlistForDurableTwoPhase(
View Full Code Here

        /*
         * Add client handler chain
         */
        BindingProvider bindingProvider = (BindingProvider) client;
        List<Handler> handlers = new ArrayList<Handler>(1);
        handlers.add(new JaxWSHeaderContextProcessor());
        bindingProvider.getBinding().setHandlerChain(handlers);

        /*
         * Lookup the DNS name of the server from the environment and set the endpoint address on the client.
         */
 
View Full Code Here

        /*
         * Add client handler chain so that XTS can add the transaction context to the SOAP messages.
         */
        BindingProvider bindingProvider = (BindingProvider) set;
        List<Handler> handlers = new ArrayList<Handler>(1);
        handlers.add(new JaxWSHeaderContextProcessor());
        bindingProvider.getBinding().setHandlerChain(handlers);
    }
View Full Code Here

        /*
         * Add client handler chain so that XTS can add the transaction context to the SOAP messages.
         */
        BindingProvider bindingProvider = (BindingProvider) set;
        List<Handler> handlers = new ArrayList<Handler>(1);
        handlers.add(new JaxWSHeaderContextProcessor());
        bindingProvider.getBinding().setHandlerChain(handlers);
    }
View Full Code Here

TOP

Related Classes of com.arjuna.mw.wst11.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.