Results 1 to 1 of 1

Thread: UnexpectedRollbackException in commit method of AbstractPlatformTransactionManager

  1. #1
    Join Date
    May 2007
    Posts
    3

    Default UnexpectedRollbackException in commit method of AbstractPlatformTransactionManager

    Am wondering about the usage of UnexpectedRollbackException which is being thrown in the commit method of AbstractPlatformTransactionManager, which doesn't seem to be logical, correct me if am wrong......


    i have just posted the commit method code from AbstractPlatformTransactionManager below which throws UnexpectedRollbackException



    Code:
    {
    		if (status.isCompleted()) {
    			throw new IllegalTransactionStateException(
    					"Transaction is already completed - do not call commit or rollback more than once per transaction");
    		}
    		DefaultTransactionStatus defStatus = (DefaultTransactionStatus) status;
    		if (defStatus.isLocalRollbackOnly()) {
    			if (defStatus.isDebug()) {
    				logger.debug("Transactional code has requested rollback");
    			}
    			processRollback(defStatus);
    			return;
    		}
    		if (!shouldCommitOnGlobalRollbackOnly() && defStatus.isGlobalRollbackOnly()) {
    			if (defStatus.isDebug()) {
    				logger.debug("Global transaction is marked as rollback-only but transactional code requested commit");
    			}
    			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;
    		}
    		processCommit(defStatus);
    }

    Thanks in advance....
    Last edited by Ranjeeth; Dec 26th, 2008 at 12:48 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •