Package javax.transaction

Examples of javax.transaction.TransactionManager


      }

      public void begin()
      throws NotSupportedException, SystemException
      {
         TransactionManager tm = con.getTransactionManager();

         int oldTimeout = -1;
         if (tm instanceof TransactionTimeoutConfiguration)
            oldTimeout = ((TransactionTimeoutConfiguration) tm).getTransactionTimeout();

         // Set the timeout value
         tm.setTransactionTimeout(timeout);

         try
         {
            // Start the transaction
            tm.begin();

            //notify checked out connections
            EJB2UserTransactionProvider.getSingleton().userTransactionStarted();
            if (tsl != null)
               tsl.userTransactionStarted();

            Transaction tx = tm.getTransaction();
            if (trace)
               log.trace("UserTx begin: " + tx);

            // keep track of the transaction in enterprise context for BMT
            setTransaction(tx);
         }
         finally
         {
            // Reset the transaction timeout (if we know what it was)
            if (oldTimeout != -1)
               tm.setTransactionTimeout(oldTimeout);
         }
      }
View Full Code Here


      public void commit()
      throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
      SecurityException, IllegalStateException, SystemException
      {
         TransactionManager tm = con.getTransactionManager();
         try
         {
            Transaction tx = tm.getTransaction();
            if (trace)
               log.trace("UserTx commit: " + tx);

            int status = tm.getStatus();
            tm.commit();
         }
         finally
         {
            // According to the spec, after commit and rollback was called on
            // UserTransaction, the thread is associated with no transaction.
View Full Code Here

      }

      public void rollback()
      throws IllegalStateException, SecurityException, SystemException
      {
         TransactionManager tm = con.getTransactionManager();
         try
         {
            Transaction tx = tm.getTransaction();
            if (trace)
               log.trace("UserTx rollback: " + tx);
            tm.rollback();
         }
         finally
         {
            // According to the spec, after commit and rollback was called on
            // UserTransaction, the thread is associated with no transaction.
View Full Code Here

      }

      public void setRollbackOnly()
      throws IllegalStateException, SystemException
      {
         TransactionManager tm = con.getTransactionManager();
         Transaction tx = tm.getTransaction();
         if (trace)
            log.trace("UserTx setRollbackOnly: " + tx);

         tm.setRollbackOnly();
      }
View Full Code Here

      }

      public int getStatus()
      throws SystemException
      {
         TransactionManager tm = con.getTransactionManager();
         return tm.getStatus();
      }
View Full Code Here

      }
   }
  
   private void checkTransaction() throws RemoteException
   {
      TransactionManager tm = TransactionManagerLocator.getInstance().locate();
      try
      {
         Transaction tx = tm.getTransaction();
         if (tx != null)
            throw new RemoteException("There should be no transaction context: " + tx);
      }
      catch (RemoteException e)
      {
View Full Code Here

    public TransactionManager getTransactionManager(ClassLoaderResolver clr)
    {
        if (locator != null)
        {
            // User has specified the locator to use
            TransactionManager tm = getTransactionManagerForLocator(clr, locator);
            if (tm != null)
            {
                return tm;
            }
        }
        else
        {
            // User hasnt specified which locator so go through them all
            for (int i=0;i<locators.length;i++)
            {
                TransactionManager tm = getTransactionManagerForLocator(clr, locators[i]);
                if (tm != null)
                {
                    return tm;
                }
            }
View Full Code Here

                }

                if (loc != null)
                {
                    // Return the actual TransactionManager
                    TransactionManager tm = loc.getTransactionManager(clr);
                    if (tm != null)
                    {
                        return tm;
                    }
                }
View Full Code Here

     * @return The TransactionManager
     * @throws JPOXTransactionException if an error occurs obtaining the transaction manager
     */
    private TransactionManager obtainTransactionManager()
    {
        TransactionManager tm = om.getOMFContext().getJtaTransactionManager();
        if (tm == null)
        {
            throw new JPOXTransactionException(LOCALISER.msg("015030"));
        }
        else
View Full Code Here

    public TransactionManager getTransactionManager(ClassLoaderResolver clr)
    {
        if (locator != null)
        {
            // User has specified the locator to use
            TransactionManager tm = getTransactionManagerForLocator(clr, locator);
            if (tm != null)
            {
                return tm;
            }
        }
        else
        {
            // User hasnt specified which locator so go through them all
            for (int i=0;i<locators.length;i++)
            {
                TransactionManager tm = getTransactionManagerForLocator(clr, locators[i]);
                if (tm != null)
                {
                    return tm;
                }
            }
View Full Code Here

TOP

Related Classes of javax.transaction.TransactionManager

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.