Example usage for org.springframework.transaction HeuristicCompletionException HeuristicCompletionException

List of usage examples for org.springframework.transaction HeuristicCompletionException HeuristicCompletionException

Introduction

In this page you can find the example usage for org.springframework.transaction HeuristicCompletionException HeuristicCompletionException.

Prototype

public HeuristicCompletionException(int outcomeState, Throwable cause) 

Source Link

Document

Constructor for HeuristicCompletionException.

Usage

From source file:bigbank.transaction.ChainedTransactionManager.java

@Override
public void commit(TransactionStatus status) throws TransactionException {

    MultiTransactionStatus multiTransactionStatus = (MultiTransactionStatus) status;

    boolean commit = true;
    Exception commitException = null;
    PlatformTransactionManager commitExceptionTransactionManager = null;

    for (PlatformTransactionManager transactionManager : reverse(transactionManagers)) {
        if (commit) {
            try {
                multiTransactionStatus.commit(transactionManager);
            } catch (Exception ex) {
                commit = false;/*from w  ww  . ja  va2 s . c o m*/
                commitException = ex;
                commitExceptionTransactionManager = transactionManager;
            }
        } else {
            // after unsucessfull commit we must try to rollback remaining
            // transaction managers
            try {
                multiTransactionStatus.rollback(transactionManager);
            } catch (Exception ex) {
                logger.warn("Rollback exception (after commit) (" + transactionManager + ") " + ex.getMessage(),
                        ex);
            }
        }
    }

    if (multiTransactionStatus.isNewSynchonization()) {
        synchronizationManager.clearSynchronization();
    }

    if (commitException != null) {
        boolean firstTransactionManagerFailed = commitExceptionTransactionManager == getLastTransactionManager();
        int transactionState = firstTransactionManagerFailed ? HeuristicCompletionException.STATE_ROLLED_BACK
                : HeuristicCompletionException.STATE_MIXED;
        throw new HeuristicCompletionException(transactionState, commitException);
    }

}

From source file:com.zhengmo.data.transaction.ChainedTransactionManager.java

@Override
public void commit(TransactionStatus status) throws TransactionException {
    MultiTransactionStatus multiTransactionStatus = (MultiTransactionStatus) status;
    boolean commit = true;
    Exception commitException = null;
    PlatformTransactionManager commitExceptionTransactionManager = null;
    for (PlatformTransactionManager transactionManager : reverse(transactionManagers)) {
        if (commit) {
            try {
                multiTransactionStatus.commit(transactionManager);
            } catch (Exception ex) {
                commit = false;/*from   w w w. j  a  va  2  s.c  o  m*/
                commitException = ex;
                commitExceptionTransactionManager = transactionManager;
            }
        } else {
            // after unsucessfull commit we must try to rollback remaining transaction managers
            try {
                multiTransactionStatus.rollback(transactionManager);
            } catch (Exception ex) {
                LOGGER.warn("Rollback exception (after commit) (" + transactionManager + ") " + ex.getMessage(),
                        ex);
            }
        }
    }
    if (multiTransactionStatus.isNewSynchonization()) {
        synchronizationManager.clearSynchronization();
    }
    if (commitException != null) {
        boolean firstTransactionManagerFailed = commitExceptionTransactionManager == getLastTransactionManager();
        int transactionState = firstTransactionManagerFailed ? HeuristicCompletionException.STATE_ROLLED_BACK
                : HeuristicCompletionException.STATE_MIXED;
        throw new HeuristicCompletionException(transactionState, commitException);
    }
}

From source file:com.becool.base.spring.tx.ChainedTransactionManager.java

public void commit(TransactionStatus status) throws TransactionException {

    MultiTransactionStatus multiTransactionStatus = (MultiTransactionStatus) status;

    boolean commit = true;
    Exception commitException = null;
    PlatformTransactionManager commitExceptionTransactionManager = null;

    for (PlatformTransactionManager transactionManager : reverse(transactionManagers)) {

        if (commit) {

            try {
                multiTransactionStatus.commit(transactionManager);
            } catch (Exception ex) {
                commit = false;/*from  w w  w.  ja va  2  s. c o m*/
                commitException = ex;
                commitExceptionTransactionManager = transactionManager;
            }

        } else {

            // after unsucessfull commit we must try to rollback remaining transaction managers

            try {
                multiTransactionStatus.rollback(transactionManager);
            } catch (Exception ex) {
                LOGGER.warn("Rollback exception (after commit) (" + transactionManager + ") " + ex.getMessage(),
                        ex);
            }
        }
    }
    if (multiTransactionStatus.isNewSynchonization()) {
        synchronizationManager.clearSynchronization();
    }

    if (commitException != null) {
        boolean firstTransactionManagerFailed = commitExceptionTransactionManager == getLastTransactionManager();
        int transactionState = firstTransactionManagerFailed ? HeuristicCompletionException.STATE_ROLLED_BACK
                : HeuristicCompletionException.STATE_MIXED;
        throw new HeuristicCompletionException(transactionState, commitException);
    }
}

From source file:org.danielli.xultimate.transaction.ChainedTransactionManager.java

public void commit(TransactionStatus status) throws TransactionException {

    MultiTransactionStatus multiTransactionStatus = (MultiTransactionStatus) status;

    boolean commit = true;
    Exception commitException = null;
    PlatformTransactionManager commitExceptionTransactionManager = null;

    for (PlatformTransactionManager transactionManager : reverse(transactionManagers)) {

        if (commit) {

            try {
                multiTransactionStatus.commit(transactionManager);
            } catch (Exception ex) {
                commit = false;//from   w  w w .j a v  a 2  s .c  o m
                commitException = ex;
                commitExceptionTransactionManager = transactionManager;
            }

        } else {

            // after unsucessfull commit we must try to rollback remaining transaction managers

            try {
                multiTransactionStatus.rollback(transactionManager);
            } catch (Exception ex) {
                LOGGER.warn("Rollback exception (after commit) (" + transactionManager + ") " + ex.getMessage(),
                        ex);
            }
        }
    }

    if (multiTransactionStatus.isNewSynchonization()) {
        synchronizationManager.clearSynchronization();
    }

    if (commitException != null) {
        boolean firstTransactionManagerFailed = commitExceptionTransactionManager == getLastTransactionManager();
        int transactionState = firstTransactionManagerFailed ? HeuristicCompletionException.STATE_ROLLED_BACK
                : HeuristicCompletionException.STATE_MIXED;
        throw new HeuristicCompletionException(transactionState, commitException);
    }
}

From source file:de.faustedition.db.ChainedTransactionManager.java

@Override
public void commit(TransactionStatus status) throws TransactionException {

    MultiTransactionStatus multiTransactionStatus = (MultiTransactionStatus) status;

    boolean commit = true;
    Exception commitException = null;
    PlatformTransactionManager commitExceptionTransactionManager = null;

    for (PlatformTransactionManager transactionManager : reverse(transactionManagers)) {
        if (commit) {
            try {
                multiTransactionStatus.commit(transactionManager);
            } catch (Exception ex) {
                commit = false;//from  w w  w.  j a  v a  2 s  .c o  m
                commitException = ex;
                commitExceptionTransactionManager = transactionManager;
            }
        } else {
            //after unsucessfull commit we must try to rollback remaining transaction managers
            try {
                multiTransactionStatus.rollback(transactionManager);
            } catch (Exception ex) {
                logger.warn("Rollback exception (after commit) (" + transactionManager + ") " + ex.getMessage(),
                        ex);
            }
        }
    }

    if (multiTransactionStatus.isNewSynchonization()) {
        synchronizationManager.clearSynchronization();
    }

    if (commitException != null) {
        boolean firstTransactionManagerFailed = commitExceptionTransactionManager == getLastTransactionManager();
        int transactionState = firstTransactionManagerFailed ? HeuristicCompletionException.STATE_ROLLED_BACK
                : HeuristicCompletionException.STATE_MIXED;
        throw new HeuristicCompletionException(transactionState, commitException);
    }

}