Search in sources :

Example 1 with RecoverableTransactionManager

use of org.apache.geronimo.transaction.manager.RecoverableTransactionManager in project tomee by apache.

the class GeronimoConnectionManagerFactory method create.

public GenericConnectionManager create() {
    final PoolingSupport poolingSupport = createPoolingSupport();
    ClassLoader classLoader = this.classLoader;
    if (classLoader == null) {
        Thread.currentThread().getContextClassLoader();
    }
    if (classLoader == null) {
        classLoader = getClass().getClassLoader();
    }
    if (classLoader == null) {
        classLoader = ClassLoader.getSystemClassLoader();
    }
    final TransactionSupport txSupport = createTransactionSupport();
    final RecoverableTransactionManager tm;
    if (transactionManager instanceof RecoverableTransactionManager) {
        tm = (RecoverableTransactionManager) transactionManager;
    } else {
        if (txSupport.isRecoverable()) {
            throw new OpenEJBRuntimeException("currently recoverable tx support (xa) needs a geronimo tx manager");
        }
        tm = new SimpleRecoverableTransactionManager(transactionManager, name);
    }
    final GenericConnectionManager mgr;
    if (validationIntervalMs >= 0 && mcf instanceof ValidatingManagedConnectionFactory) {
        if (name == null) {
            name = getClass().getSimpleName();
        }
        mgr = new ValidatingGenericConnectionManager(txSupport, poolingSupport, null, new AutoConnectionTracker(), tm, mcf, name, classLoader, validationIntervalMs);
    } else {
        mgr = new GenericConnectionManager(txSupport, poolingSupport, null, new AutoConnectionTracker(), tm, mcf, name, classLoader);
    }
    return mgr;
}
Also used : OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) RecoverableTransactionManager(org.apache.geronimo.transaction.manager.RecoverableTransactionManager) GenericConnectionManager(org.apache.geronimo.connector.outbound.GenericConnectionManager) TransactionSupport(org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport) PoolingSupport(org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport) ValidatingManagedConnectionFactory(javax.resource.spi.ValidatingManagedConnectionFactory)

Aggregations

ValidatingManagedConnectionFactory (javax.resource.spi.ValidatingManagedConnectionFactory)1 GenericConnectionManager (org.apache.geronimo.connector.outbound.GenericConnectionManager)1 PoolingSupport (org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport)1 TransactionSupport (org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport)1 RecoverableTransactionManager (org.apache.geronimo.transaction.manager.RecoverableTransactionManager)1 OpenEJBRuntimeException (org.apache.openejb.OpenEJBRuntimeException)1