java.sql.DriverManager directly to open connections and provides
a very rudimentary connection pool.
IMPL NOTE : not intended for production use!
Thanks to Oleg Varaksin and his article on object pooling using the java. package, from
which much of the pooling code here is derived. See http://ovaraksin.blogspot.com/2013/08/simple-and-lightweight-pool.html
| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| public static final String | |
| public static final String | |
| private static final ConnectionPoolingLogger | |
| public static final String | |
| private volatile ServiceRegistryImplementor | |
| private volatile DriverManagerConnectionProviderImpl. | |
| public static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static ConnectionCreator | |
| private DriverManagerConnectionProviderImpl. | |
| public void | closeConnection(Connection
The JDBC connection to release conn)Implements org. |
| public void | configure(Map<K, V>
The configuration properties. configurationValues)Implements org. |
| protected void | finalize()
Overrides java. |
| public Connection | getConnection()
Implements org. |
| public Properties | |
| public void | injectServices(ServiceRegistryImplementor
The registry serviceRegistry)Implements org. |
| public boolean | isUnwrappableAs(Class<T>
The type to check. unwrapType)Implements org. |
| public boolean | isValid(Connection connection)
Implements org. |
| private static ConnectionCreatorFactory | loadConnectionCreatorFactory(String connectionCreatorFactoryClassName, ServiceRegistryImplementor serviceRegistry)
|
| private static Driver | |
| public void | |
| public boolean | supportsAggressiveRelease()
Implements org. |
| public <T> T | unwrap(Class<T>
The java type as which to unwrap this instance. unwrapType)Implements org. |
| protected void |
| CONNECTION_CREATOR_FACTORY | back to summary |
|---|---|
| public static final String CONNECTION_CREATOR_FACTORY | |
| INIT_SQL | back to summary |
|---|---|
| public static final String INIT_SQL | |
| INITIAL_SIZE | back to summary |
|---|---|
| public static final String INITIAL_SIZE | |
| log | back to summary |
|---|---|
| private static final ConnectionPoolingLogger log | |
| MIN_SIZE | back to summary |
|---|---|
| public static final String MIN_SIZE | |
| serviceRegistry | back to summary |
|---|---|
| private volatile ServiceRegistryImplementor serviceRegistry | |
| state | back to summary |
|---|---|
| private volatile DriverManagerConnectionProviderImpl. | |
| VALIDATION_INTERVAL | back to summary |
|---|---|
| public static final String VALIDATION_INTERVAL | |
| DriverManagerConnectionProviderImpl | back to summary |
|---|---|
| public DriverManagerConnectionProviderImpl() | |
| buildCreator | back to summary |
|---|---|
| private static ConnectionCreator buildCreator(Map<K, V> configurationValues, ServiceRegistryImplementor serviceRegistry) | |
| buildPool | back to summary |
|---|---|
| private DriverManagerConnectionProviderImpl. | |
| closeConnection | back to summary |
|---|---|
| public void closeConnection(Connection conn) throws SQLException Implements org. Doc from org. Release a connection from Hibernate use.
| |
| configure | back to summary |
|---|---|
| public void configure(Map<K, V> configurationValues) Implements org. Doc from org. Configure the service. | |
| finalize | back to summary |
|---|---|
| protected void finalize() throws Throwable Overrides java. Doc from java. Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
A subclass overrides the
When running in a Java virtual machine in which finalization has been
disabled or removed, the garbage collector will never call
The general contract of
The
The Java programming language does not guarantee which thread will
invoke the
After the
The
Any exception thrown by the | |
| getConnection | back to summary |
|---|---|
| public Connection getConnection() throws SQLException Implements org. Doc from org. Obtains a connection for Hibernate use according to the underlying strategy of this provider.
| |
| getConnectionProperties | back to summary |
|---|---|
| public Properties getConnectionProperties() Exposed to facilitate testing only. | |
| injectServices | back to summary |
|---|---|
| public void injectServices(ServiceRegistryImplementor serviceRegistry) Implements org. Doc from org. Callback to inject the registry.
| |
| isUnwrappableAs | back to summary |
|---|---|
| public boolean isUnwrappableAs(Class<T> unwrapType) Implements org. Doc from org. Can this wrapped service be unwrapped as the indicated type? | |
| isValid | back to summary |
|---|---|
| public boolean isValid(Connection connection) throws SQLException Implements org. Doc from org. Checks if the connection is still valid
| |
| loadConnectionCreatorFactory | back to summary |
|---|---|
| private static ConnectionCreatorFactory loadConnectionCreatorFactory(String connectionCreatorFactoryClassName, ServiceRegistryImplementor serviceRegistry) | |
| loadDriverIfPossible | back to summary |
|---|---|
| private static Driver loadDriverIfPossible(String driverClassName, ServiceRegistryImplementor serviceRegistry) | |
| stop | back to summary |
|---|---|
| public void stop() Implements org. Doc from org. Stop phase notification
| |
| supportsAggressiveRelease | back to summary |
|---|---|
| public boolean supportsAggressiveRelease() Implements org. Doc from org. Does this connection provider support aggressive release of JDBC connections and re-acquisition of those connections (if need be) later?
This is used in conjunction with Typically, this is only true in managed environments where a container tracks connections by transaction or thread. Note that JTA semantic depends on the fact that the underlying connection provider does support aggressive release.
| |
| unwrap | back to summary |
|---|---|
| public <T> T unwrap(Class<T> unwrapType) Implements org. Doc from org. Unproxy the service proxy
| |
| validateConnectionsReturned | back to summary |
|---|---|
| protected void validateConnectionsReturned() | |
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private final ConcurrentLinkedQueue | |
| private final boolean | |
| private final ConcurrentLinkedQueue | |
| private final ConnectionCreator | |
| private final ConnectionValidator | |
| private static final CoreMessageLogger | |
| private final int | |
| private final int | |
| private volatile boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected void | |
| public void | |
| protected void | |
| public String | |
| public Connection | |
| protected Connection | |
| protected Connection | |
| protected void | |
| public int | |
| public void |
| allConnections | back to summary |
|---|---|
| private final ConcurrentLinkedQueue<Connection> allConnections | |
| autoCommit | back to summary |
|---|---|
| private final boolean autoCommit | |
| availableConnections | back to summary |
|---|---|
| private final ConcurrentLinkedQueue<Connection> availableConnections | |
| connectionCreator | back to summary |
|---|---|
| private final ConnectionCreator connectionCreator | |
| connectionValidator | back to summary |
|---|---|
| private final ConnectionValidator connectionValidator | |
| log | back to summary |
|---|---|
| private static final CoreMessageLogger log | |
| maxSize | back to summary |
|---|---|
| private final int maxSize | |
| minSize | back to summary |
|---|---|
| private final int minSize | |
| primed | back to summary |
|---|---|
| private volatile boolean primed | |
| PooledConnections | back to summary |
|---|---|
| private PooledConnections(DriverManagerConnectionProviderImpl. | |
| add | back to summary |
|---|---|
| public void add(Connection conn) throws SQLException | |
| addConnections | back to summary |
|---|---|
| protected void addConnections(int numberOfConnections) | |
| close | back to summary |
|---|---|
| public void close() throws SQLException | |
| closeConnection | back to summary |
|---|---|
| protected void closeConnection(Connection conn, Throwable t) | |
| getUrl | back to summary |
|---|---|
| public String getUrl() | |
| poll | back to summary |
|---|---|
| public Connection poll() throws SQLException | |
| prepareConnection | back to summary |
|---|---|
| protected Connection prepareConnection(Connection conn) | |
| releaseConnection | back to summary |
|---|---|
| protected Connection releaseConnection(Connection conn) | |
| removeConnections | back to summary |
|---|---|
| protected void removeConnections(int numberToBeRemoved) | |
| size | back to summary |
|---|---|
| public int size() | |
| validate | back to summary |
|---|---|
| public void validate() | |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final ConnectionCreator | |
| private ConnectionValidator | |
| private int | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public DriverManagerConnectionProviderImpl. | |
| public DriverManagerConnectionProviderImpl. | |
| public DriverManagerConnectionProviderImpl. | |
| public DriverManagerConnectionProviderImpl. | |
| public DriverManagerConnectionProviderImpl. |
| autoCommit | back to summary |
|---|---|
| private boolean autoCommit | |
| connectionCreator | back to summary |
|---|---|
| private final ConnectionCreator connectionCreator | |
| connectionValidator | back to summary |
|---|---|
| private ConnectionValidator connectionValidator | |
| initialSize | back to summary |
|---|---|
| private int initialSize | |
| maxSize | back to summary |
|---|---|
| private int maxSize | |
| minSize | back to summary |
|---|---|
| private int minSize | |
| Builder | back to summary |
|---|---|
| public Builder(ConnectionCreator connectionCreator, boolean autoCommit) | |
| build | back to summary |
|---|---|
| public DriverManagerConnectionProviderImpl. | |
| initialSize | back to summary |
|---|---|
| public DriverManagerConnectionProviderImpl. | |
| maxSize | back to summary |
|---|---|
| public DriverManagerConnectionProviderImpl. | |
| minSize | back to summary |
|---|---|
| public DriverManagerConnectionProviderImpl. | |
| validator | back to summary |
|---|---|
| public DriverManagerConnectionProviderImpl. | |
| Modifier and Type | Field and Description |
|---|---|
| private volatile boolean | |
| private ScheduledExecutorService | |
| private final DriverManagerConnectionProviderImpl. | |
| private final ReadWriteLock | |
| private final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Connection | |
| private void | |
| public void |
| active | back to summary |
|---|---|
| private volatile boolean active | |
| executorService | back to summary |
|---|---|
| private ScheduledExecutorService executorService | |
| pool | back to summary |
|---|---|
| private final DriverManagerConnectionProviderImpl. | |
| statelock | back to summary |
|---|---|
| private final ReadWriteLock statelock | |
| validationInterval | back to summary |
|---|---|
| private final long validationInterval | |
| PoolState | back to summary |
|---|---|
| public PoolState(DriverManagerConnectionProviderImpl. | |
| closeConnection | back to summary |
|---|---|
| public void closeConnection(Connection conn) throws SQLException | |
| getConnection | back to summary |
|---|---|
| public Connection getConnection() throws SQLException | |
| startIfNeeded | back to summary |
|---|---|
| private void startIfNeeded() | |
| stop | back to summary |
|---|---|
| public void stop() | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Thread | newThread(Runnable
a runnable to be executed by new thread instance runnable)Implements java. Thread to run the given runnable.
|
| ValidationThreadFactory | back to summary |
|---|---|
| private ValidationThreadFactory() | |
| newThread | back to summary |
|---|---|
| public Thread newThread(Runnable runnable) Implements java. Doc from java. Constructs a new unstarted | |