Search in sources :

Example 1 with SimpleConnectionFactory

use of org.infinispan.persistence.jdbc.common.impl.connectionfactory.SimpleConnectionFactory in project infinispan by infinispan.

the class UnitTestDatabaseManager method verifyConnectionLeaks.

public static void verifyConnectionLeaks(ConnectionFactory connectionFactory) {
    if (connectionFactory instanceof PooledConnectionFactory) {
        PooledConnectionFactory pcf = (PooledConnectionFactory) connectionFactory;
        try {
            // C3P0 needs a little delay before reporting the correct number of connections. Bah!
            Thread.sleep(500);
            assertEquals(pcf.getActiveConnections(), 0);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    } else if (connectionFactory instanceof SimpleConnectionFactory) {
        SimpleConnectionFactory scf = (SimpleConnectionFactory) connectionFactory;
        assertEquals(scf.getConnectionCount(), 0);
    }
}
Also used : SimpleConnectionFactory(org.infinispan.persistence.jdbc.common.impl.connectionfactory.SimpleConnectionFactory) PooledConnectionFactory(org.infinispan.persistence.jdbc.common.impl.connectionfactory.PooledConnectionFactory)

Example 2 with SimpleConnectionFactory

use of org.infinispan.persistence.jdbc.common.impl.connectionfactory.SimpleConnectionFactory in project infinispan by infinispan.

the class StringStoreWithManagedConnectionFunctionalTest method getConnectionFactory.

@Override
protected ConnectionFactory getConnectionFactory(JdbcStringBasedStoreConfigurationBuilder storeBuilder) {
    SimpleConnectionFactory simpleFactory = new SimpleConnectionFactory();
    simpleFactory.start(configureSimpleConnectionFactory(storeBuilder).create(), Thread.currentThread().getContextClassLoader());
    return simpleFactory;
}
Also used : UnitTestDatabaseManager.configureSimpleConnectionFactory(org.infinispan.persistence.jdbc.UnitTestDatabaseManager.configureSimpleConnectionFactory) SimpleConnectionFactory(org.infinispan.persistence.jdbc.common.impl.connectionfactory.SimpleConnectionFactory)

Aggregations

SimpleConnectionFactory (org.infinispan.persistence.jdbc.common.impl.connectionfactory.SimpleConnectionFactory)2 UnitTestDatabaseManager.configureSimpleConnectionFactory (org.infinispan.persistence.jdbc.UnitTestDatabaseManager.configureSimpleConnectionFactory)1 PooledConnectionFactory (org.infinispan.persistence.jdbc.common.impl.connectionfactory.PooledConnectionFactory)1