Package org.datanucleus.store.rdbms
Class ConnectionFactoryImpl
- java.lang.Object
-
- org.datanucleus.store.connection.AbstractConnectionFactory
-
- org.datanucleus.store.rdbms.ConnectionFactoryImpl
-
- All Implemented Interfaces:
org.datanucleus.store.connection.ConnectionFactory
public class ConnectionFactoryImpl extends org.datanucleus.store.connection.AbstractConnectionFactoryConnectionFactory for RDBMS datastores. Each instance is a factory of transactional or non-transactional connections, obtained through a javax.sql.DataSource.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classConnectionFactoryImpl.EmulatedXAResourceEmulate the two phase protocol for non XA(package private) classConnectionFactoryImpl.ManagedConnectionImpl
-
Field Summary
Fields Modifier and Type Field Description (package private) javax.sql.DataSourcedataSourceDataSource from which to get the connections.(package private) ConnectionPoolpoolOptional locally-managed pool of connections from which we get our connections (when using URL), that backs the dataSource.
-
Constructor Summary
Constructors Constructor Description ConnectionFactoryImpl(org.datanucleus.store.StoreManager storeMgr, java.lang.String resourceName)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()org.datanucleus.store.connection.ManagedConnectioncreateManagedConnection(org.datanucleus.ExecutionContext ec, java.util.Map options)Method to create a new ManagedConnection.private javax.sql.DataSourcegenerateDataSource(org.datanucleus.store.StoreManager storeMgr, java.lang.Object connDS, java.lang.String connJNDI, java.lang.String resourceName, java.lang.String requiredPoolingType, java.lang.String connURL)Method to generate the datasource used by this connection factory.protected voidinitialiseDataSource()Method to initialise the DataSource used by this ConnectionFactory.
-
-
-
Field Detail
-
dataSource
javax.sql.DataSource dataSource
DataSource from which to get the connections.
-
pool
ConnectionPool pool
Optional locally-managed pool of connections from which we get our connections (when using URL), that backs the dataSource. This is stored so that we can close the pool upon close.
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceorg.datanucleus.store.connection.ConnectionFactory- Overrides:
closein classorg.datanucleus.store.connection.AbstractConnectionFactory
-
initialiseDataSource
protected void initialiseDataSource()
Method to initialise the DataSource used by this ConnectionFactory. Only invoked when the request for the first connection comes in.
-
generateDataSource
private javax.sql.DataSource generateDataSource(org.datanucleus.store.StoreManager storeMgr, java.lang.Object connDS, java.lang.String connJNDI, java.lang.String resourceName, java.lang.String requiredPoolingType, java.lang.String connURL)Method to generate the datasource used by this connection factory. Searches initially for a provided DataSource then, if not found, for JNDI DataSource, and finally for the DataSource at a connection URL.- Parameters:
storeMgr- Store ManagerconnDS- Factory data source objectconnJNDI- DataSource JNDI name(s)resourceName- Resource namerequiredPoolingType- Type of connection poolconnURL- URL for connections- Returns:
- The DataSource
-
createManagedConnection
public org.datanucleus.store.connection.ManagedConnection createManagedConnection(org.datanucleus.ExecutionContext ec, java.util.Map options)Method to create a new ManagedConnection.- Parameters:
ec- the object that is bound the connection during its lifecycle (if for a PM/EM operation)options- Options for creating the connection (optional)- Returns:
- The ManagedConnection
-
-