Class PooledConnectionFactory
- java.lang.Object
-
- org.infinispan.persistence.jdbc.connectionfactory.ConnectionFactory
-
- org.infinispan.persistence.jdbc.connectionfactory.PooledConnectionFactory
-
public class PooledConnectionFactory extends ConnectionFactory
Pooled connection factory that uses HikariCP by default. In order to utilise the legacy connection pool, C3P0, users must pass the system property infinispan.jdbc.c3p0.force with the value true. HikariCP property files can be specified by explicitly stating its path or name (if the file is on the classpath) via PooledConnectionFactoryConfiguration.propertyFile field. Or by ensuring that a hikari.properties file is on the classpath. Note, that the file specified by propertyField takes precedence over hikari.properties. For a complete configuration reference for C3P0 look here. The connection pool can be configured n various ways, as described here. The simplest way is by having an c3p0.properties file in the classpath. If no properties files are found for either HikariCP or C3PO then the default values of these connection pools are utilised.- Author:
- Mircea.Markus@jboss.com, Tristan Tarrant, Ryan Emerson
-
-
Constructor Summary
Constructors Constructor Description PooledConnectionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connection
getConnection()
Fetches a connection from the factory.int
getMaxPoolSize()
int
getNumBusyConnectionsAllUsers()
int
getNumConnectionsAllUsers()
void
releaseConnection(Connection conn)
Destroys a connection.void
start(ConnectionFactoryConfiguration config, ClassLoader classLoader)
Starts the connection factory.void
stop()
Closes the connection factory, including all allocated connections etc.-
Methods inherited from class org.infinispan.persistence.jdbc.connectionfactory.ConnectionFactory
getConnectionFactory, getConnectionFactory
-
-
-
-
Method Detail
-
start
public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws org.infinispan.persistence.spi.PersistenceException
Description copied from class:ConnectionFactory
Starts the connection factory. A pooled factory might be create connections here.- Specified by:
start
in classConnectionFactory
- Throws:
org.infinispan.persistence.spi.PersistenceException
-
stop
public void stop()
Description copied from class:ConnectionFactory
Closes the connection factory, including all allocated connections etc.- Specified by:
stop
in classConnectionFactory
-
getConnection
public Connection getConnection() throws org.infinispan.persistence.spi.PersistenceException
Description copied from class:ConnectionFactory
Fetches a connection from the factory.- Specified by:
getConnection
in classConnectionFactory
- Throws:
org.infinispan.persistence.spi.PersistenceException
-
releaseConnection
public void releaseConnection(Connection conn)
Description copied from class:ConnectionFactory
Destroys a connection. Important: null might be passed in, as an valid argument.- Specified by:
releaseConnection
in classConnectionFactory
-
getMaxPoolSize
public int getMaxPoolSize()
-
getNumConnectionsAllUsers
public int getNumConnectionsAllUsers() throws SQLException
- Throws:
SQLException
-
getNumBusyConnectionsAllUsers
public int getNumBusyConnectionsAllUsers() throws SQLException
- Throws:
SQLException
-
-