Java 类org.quartz.ee.jta.UserTransactionHelper 实例源码

项目:lams    文件:SchedulerPluginWithUserTransactionSupport.java   
/**
 * If <em>wrapInUserTransaction</em> is true, starts a new UserTransaction 
 * and returns it. Otherwise, or if establishing the transaction fail, it 
 * will return null.
 */
private UserTransaction startUserTransaction() {
    if (wrapInUserTransaction == false) {
        return null;
    }

    UserTransaction userTransaction = null;
    try {
        userTransaction = UserTransactionHelper.lookupUserTransaction();
        userTransaction.begin();
    } catch (Throwable t) {
        UserTransactionHelper.returnUserTransaction(userTransaction);
        userTransaction = null;
        getLog().error("Failed to start UserTransaction for plugin: " + getName(), t);
    }

    return userTransaction;
}
项目:lams    文件:SchedulerPluginWithUserTransactionSupport.java   
/**
 * If the given UserTransaction is not null, it is committed/rolledback,
 * and then returned to the UserTransactionHelper.
 */
private void resolveUserTransaction(UserTransaction userTransaction) {
    if (userTransaction != null) {
        try {
            if (userTransaction.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
                userTransaction.rollback();
            } else {
                userTransaction.commit();
            } 
        } catch (Throwable t) {
            getLog().error("Failed to resolve UserTransaction for plugin: " + getName(), t);
        } finally {
            UserTransactionHelper.returnUserTransaction(userTransaction);
        }
    }
}
项目:asura    文件:SchedulerPluginWithUserTransactionSupport.java   
/**
 * If <em>wrapInUserTransaction</em> is true, starts a new UserTransaction 
 * and returns it. Otherwise, or if establishing the transaction fail, it 
 * will return null.
 */
private UserTransaction startUserTransaction() {
    if (wrapInUserTransaction == false) {
        return null;
    }

    UserTransaction userTransaction = null;
    try {
        userTransaction = UserTransactionHelper.lookupUserTransaction();
        userTransaction.begin();
    } catch (Throwable t) {
        UserTransactionHelper.returnUserTransaction(userTransaction);
        userTransaction = null;
        getLog().error("Failed to start UserTransaction for plugin: " + getName(), t);
    }

    return userTransaction;
}
项目:asura    文件:SchedulerPluginWithUserTransactionSupport.java   
/**
 * If the given UserTransaction is not null, it is committed/rolledback,
 * and then returned to the UserTransactionHelper.
 */
private void resolveUserTransaction(UserTransaction userTransaction) {
    if (userTransaction != null) {
        try {
            if (userTransaction.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
                userTransaction.rollback();
            } else {
                userTransaction.commit();
            } 
        } catch (Throwable t) {
            getLog().error("Failed to resolve UserTransaction for plugin: " + getName(), t);
        } finally {
            UserTransactionHelper.returnUserTransaction(userTransaction);
        }
    }
}