Examples of TxContext


Examples of com.arjuna.mw.wst.TxContext

    @Override
    public boolean isTransactionActive() {
        LOG.debug("CompensatableServiceImpl.isTransactionActive()");

        TxContext txContext = null;

        try {
            txContext = BusinessActivityManager.getBusinessActivityManager().currentTransaction();
        } catch (com.arjuna.wst.SystemException e) {
        }
View Full Code Here

Examples of com.arjuna.mw.wst.TxContext

                    Thread.currentThread().setContextClassLoader(SwitchYardRemotingServlet.class.getClassLoader());
                    cc = _txSerializer.deserialise(txContextHeader);
                } finally {
                    Thread.currentThread().setContextClassLoader(origCl);
                }
                final TxContext txContext = new TxContextImple(cc);
                TransactionManagerFactory.transactionManager().resume(txContext);

                // create or resume subordinate JTA transaction
                InboundBridge txInboundBridge = InboundBridgeManager.getInboundBridge();
                txInboundBridge.start();
View Full Code Here

Examples of com.arjuna.mw.wst.TxContext

    public static TxContext importContext(CoordinationContextType cc)
    {
        // get the subordinate transaction manager to install any existing
        // subordinate tx for this one or create and install a new one.
        final String identifier = cc.getIdentifier().getValue();
        TxContext subordinateTxContext = subordinateContextMap.get(identifier);
        if (subordinateTxContext == null) {
            // create a context for a local coordinator
            CoordinationContext context = null;
            try {
                context = atContextFactory.create(AtomicTransactionConstants.WSAT_PROTOCOL, 0L, cc, false);
View Full Code Here

Examples of com.arjuna.mw.wst.TxContext

     */
    public void beginSubordinate(int timeout) throws WrongStateException, SystemException
    {
        try
        {
            TxContext current = _ctxManager.currentTransaction();
            if ((current == null) || !(current instanceof TxContextImple))
                throw new WrongStateException();

            TxContextImple currentImple = (TxContextImple) current;
            Context ctx = startTransaction(timeout, currentImple);
View Full Code Here

Examples of com.arjuna.mw.wst.TxContext

    public static void testSuspendNullTransaction()
            throws Exception
    {
      TransactionManager ut = TransactionManager.getTransactionManager();
 
      TxContext ctx = ut.suspend();

      System.out.println("Suspended: "+ctx);

      assertTrue(ctx == null);
    }
View Full Code Here

Examples of com.arjuna.mw.wst.TxContext

      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
 
      ut.begin();
     
      TxContext ctx = tm.suspend();

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

Examples of com.arjuna.mw.wst.TxContext

  try {
      ut.begin();
     
      tm.enlistForDurableTwoPhase(p, p.identifier());

      TxContext ctx = tm.suspend();
     
      System.out.println("Suspended: "+ctx);

      tm.resume(ctx);
View Full Code Here

Examples of com.arjuna.mw.wst.TxContext

      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
 
      ut.begin();
     
      TxContext ctx = tm.suspend();

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

Examples of com.arjuna.mw.wst.TxContext

// create subordinate AT transaction
// this is surplus to requirements since we should really be running against a service which uses
// the subordinate interposition JaxWS handler to install a subordinate transaction before
// entering the service method. we ought to test that handler rather than hand crank the
// interposition in the service
                TxContext currentTx;
                TxContext newTx;
                try {
                    currentTx = TransactionManager.getTransactionManager().currentTransaction();
                } catch (SystemException e) {
                    throw new WebServiceException("subtransaction currentTransaction() failed with exception " + e);
                }

                try {
                    UserTransaction userTransaction = UserTransactionFactory.userSubordinateTransaction();
                    userTransaction.begin();
                    newTx = TransactionManager.getTransactionManager().currentTransaction();
                } catch (Exception e) {
                    throw new WebServiceException("subtransaction begin() failed with exception " + e);
                }
                String id = transactionId("at");
                subordinateTransactionMap.put(id, newTx);
                resultsList.add(id);
            } else if (command.equals("subactivity")) {
// create subordinate BA transaction
// this is surplus ot requirements since we should really be running against a service which uses
// the subordinate interposition JaxWS handler to install a subordinate activity before
// entering the service method. we ought to test that handler rather than hand crank the
// interposition in the service
                TxContext currentTx;
                TxContext newTx;
                try {
                    currentTx = BusinessActivityManagerFactory.businessActivityManager().currentTransaction();
                } catch (SystemException e) {
                    throw new WebServiceException("subtransaction currentTransaction() failed with exception " + e);
                }

                try {
                    UserBusinessActivity userBusinessActivity = UserBusinessActivityFactory.userBusinessActivity();
                    // this is nto implemented yet!!!
                    // userBusinessActivity.beginSubordinate();
                    // and this will fail with a WrongStateException
                    userBusinessActivity.begin();
                    newTx = BusinessActivityManager.getBusinessActivityManager().currentTransaction();
                } catch (Exception e) {
                    throw new WebServiceException("subtransaction begin() failed with exception " + e);
                }
                String id = transactionId("ba");
                subordinateActivityMap.put(id, newTx);
                resultsList.add(id);
            } else if (command.equals("subtransactionserve")) {
// dispatch commands in a subordinate transaction or activity
                // we should find the id of a subordinate transaction, a web service URL
                // and a list of commands to dispatch to that transaction
                // the txid and url must be resolved if supplied as bindings
                String txId = bindCommand(commandList.remove(idx), bindings, true);
                size--;
                String url = bindCommand(commandList.remove(idx), bindings,  true);
                size--;

                TxContext newTx = subordinateTransactionMap.get(txId);
                if (newTx != null) {
                    try {
                        TransactionManager.getTransactionManager().resume(newTx);
                    } catch (Exception e) {
                        throw new WebServiceException("subtransactioncommands resume() failed with exception " + e);
                    }
                } else {
                    throw new WebServiceException("subtransactioncommands unknown subordinate transaction id " + txId);
                }
                // ok, now we install the relevant transaction and then just pass the commands on to
                // the web service

                // we allow unresolved variable references in the rest of the command list as
                // they may be satisfied by embedded bind commands

                bindCommands(commandList,  bindings,  false);

                CommandsType newCommands = new CommandsType();
                List<String> newCommandList = newCommands.getCommandList();
                for (int i = 0; i < size; i++) {
                    newCommandList.add(commandList.get(i));
                }
                ResultsType subResults = serveSubordinate(url, newCommands);
                List<String> subResultsList = subResults.getResultList();
                size = subResultsList.size();
                for (idx = 0; idx < size; idx++) {
                    resultsList.add(subResultsList.get(idx));
                }
            } else if (command.equals("subactivityserve")) {
// dispatch commands in a subordinate transaction or activity
                // we should find the id of a subordinate transaction, a web service URL
                // and a list of commands to dispatch to that transaction
                // the txid and url must be resolved if supplied as bindings
                String txId = bindCommand(commandList.remove(idx), bindings, true);
                size--;
                String url = bindCommand(commandList.remove(idx), bindings,  true);
                size--;

                TxContext newTx = subordinateActivityMap.get(txId);
                if (newTx != null) {
                    try {
                        TransactionManager.getTransactionManager().resume(newTx);
                    } catch (Exception e) {
                        throw new WebServiceException("subactivitycommands resume() failed with exception " + e);
View Full Code Here

Examples of com.arjuna.mw.wst.TxContext

  catch (com.arjuna.mw.wsas.exceptions.SystemException ex)
  {
      throw new SystemException(ex.toString());
  }

  TxContext txCtx = (TxContext) _threadTxData.get();
  if (txCtx != null)
        {
      _threadTxData.set(null) ;
        }
 
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.