Package org.springframework.transaction

Examples of org.springframework.transaction.UnexpectedRollbackException


        logger.debug("Committing JMS transaction on Session [" + session + "]");
      }
      session.commit();
    }
    catch (TransactionRolledBackException ex) {
      throw new UnexpectedRollbackException("JMS transaction rolled back", ex);
    }
    catch (JMSException ex) {
      throw new TransactionSystemException("Could not commit JMS transaction", ex);
    }
  }
View Full Code Here


      }
      processRollback(defStatus);
      // Throw UnexpectedRollbackException only at outermost transaction boundary
      // or if explicitly asked to.
      if (status.isNewTransaction() || isFailEarlyOnGlobalRollbackOnly()) {
        throw new UnexpectedRollbackException(
            "Transaction rolled back because it has been marked as rollback-only");
      }
      return;
    }
View Full Code Here

          doCommit(status);
        }
        // Throw UnexpectedRollbackException if we have a global rollback-only
        // marker but still didn't get a corresponding exception from commit.
        if (globalRollbackOnly) {
          throw new UnexpectedRollbackException(
              "Transaction silently rolled back because it has been marked as rollback-only");
        }
      }
      catch (UnexpectedRollbackException ex) {
        // can only be caused by doCommit
View Full Code Here

      int jtaStatus = txObject.getUserTransaction().getStatus();
      if (jtaStatus == Status.STATUS_NO_TRANSACTION) {
        // Should never happen... would have thrown an exception before
        // and as a consequence led to a rollback, not to a commit call.
        // In any case, the transaction is already fully cleaned up.
        throw new UnexpectedRollbackException("JTA transaction already completed - probably rolled back");
      }
      if (jtaStatus == Status.STATUS_ROLLEDBACK) {
        // Only really happens on JBoss 4.2 in case of an early timeout...
        // Explicit rollback call necessary to clean up the transaction.
        // IllegalStateException expected on JBoss; call still necessary.
        try {
          txObject.getUserTransaction().rollback();
        }
        catch (IllegalStateException ex) {
          if (logger.isDebugEnabled()) {
            logger.debug("Rollback failure with transaction already marked as rolled back: " + ex);
          }
        }
        throw new UnexpectedRollbackException("JTA transaction already rolled back (probably due to a timeout)");
      }
      txObject.getUserTransaction().commit();
    }
    catch (RollbackException ex) {
      throw new UnexpectedRollbackException(
          "JTA transaction unexpectedly rolled back (maybe due to a timeout)", ex);
    }
    catch (HeuristicMixedException ex) {
      throw new HeuristicCompletionException(HeuristicCompletionException.STATE_MIXED, ex);
    }
View Full Code Here

     * cause a runtime error when you reach the final end transaction statement.
     * <p>
     * @param pRaiseException
     */
    public static void abortNested(boolean pRaiseException) {
      TransactionMgr.abortNested(pRaiseException, new UnexpectedRollbackException("TransactionMgr.abortNested invoked"));
    }
View Full Code Here

     * cause a runtime error when you reach the final end transaction statement.
     * <p>
     * @param pRaiseException
     */
    public static void abort(boolean pRaiseException) {
      TransactionMgr.abort(pRaiseException, new UnexpectedRollbackException("TransactionMgr.abort invoked"));
    }
View Full Code Here

     * cause a runtime error when you reach the final end transaction statement.
     * <p>
     * @param pRaiseException
     */
    public static void abortNested(boolean pRaiseException) {
      TransactionMgr.abortNested(pRaiseException, new UnexpectedRollbackException("TransactionMgr.abortNested invoked"));
    }
View Full Code Here

     * cause a runtime error when you reach the final end transaction statement.
     * <p>
     * @param pRaiseException
     */
    public static void abort(boolean pRaiseException) {
      TransactionMgr.abort(pRaiseException, new UnexpectedRollbackException("TransactionMgr.abort invoked"));
    }
View Full Code Here

        logger.debug("Committing JMS transaction on Session [" + session + "]");
      }
      session.commit();
    }
    catch (TransactionRolledBackException ex) {
      throw new UnexpectedRollbackException("JMS transaction rolled back", ex);
    }
    catch (JMSException ex) {
      throw new TransactionSystemException("Could not commit JMS transaction", ex);
    }
  }
View Full Code Here

      int jtaStatus = txObject.getUserTransaction().getStatus();
      if (jtaStatus == Status.STATUS_NO_TRANSACTION) {
        // Should never happen... would have thrown an exception before
        // and as a consequence led to a rollback, not to a commit call.
        // In any case, the transaction is already fully cleaned up.
        throw new UnexpectedRollbackException("JTA transaction already completed - probably rolled back");
      }
      if (jtaStatus == Status.STATUS_ROLLEDBACK) {
        // Only really happens on JBoss 4.2 in case of an early timeout...
        // Explicit rollback call necessary to clean up the transaction.
        // IllegalStateException expected on JBoss; call still necessary.
        try {
          txObject.getUserTransaction().rollback();
        }
        catch (IllegalStateException ex) {
          if (logger.isDebugEnabled()) {
            logger.debug("Rollback failure with transaction already marked as rolled back: " + ex);
          }
        }
        throw new UnexpectedRollbackException("JTA transaction already rolled back (probably due to a timeout)");
      }
      txObject.getUserTransaction().commit();
    }
    catch (RollbackException ex) {
      throw new UnexpectedRollbackException(
          "JTA transaction unexpectedly rolled back (maybe due to a timeout)", ex);
    }
    catch (HeuristicMixedException ex) {
      throw new HeuristicCompletionException(HeuristicCompletionException.STATE_MIXED, ex);
    }
View Full Code Here

TOP

Related Classes of org.springframework.transaction.UnexpectedRollbackException

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.