Class AbstractPoolBackedDataSource
- All Implemented Interfaces:
IdentityTokenized, PooledDataSource, Serializable, AutoCloseable, Wrapper, Referenceable, CommonDataSource, DataSource
- Direct Known Subclasses:
AbstractComboPooledDataSource, PoolBackedDataSource
- See Also:
-
Field Summary
Fields inherited from class PoolBackedDataSourceBase
pcs, vcs -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()C3P0 pooled DataSources use no resources before they are actually used in a VM, and they close themselves in their finalize() method.voidclose(boolean force_destroy) Deprecated.the force_destroy argument is now meaningless, as pools are no longer potentially shared between multiple DataSources.getConnection(String username, String password) floatgetEffectivePropertyCycle(String username, String password) floatgetLastAcquisitionFailure(String username, String password) getLastCheckinFailure(String username, String password) getLastCheckoutFailure(String username, String password) getLastConnectionTestFailure(String username, String password) getLastIdleTestFailure(String username, String password) intintintgetNumBusyConnections(String username, String password) intintintintgetNumConnections(String username, String password) intintlonggetNumFailedCheckins(String username, String password) longlonggetNumFailedCheckouts(String username, String password) longlonggetNumFailedIdleTests(String username, String password) longintintgetNumIdleConnections(String username, String password) intintintgetNumThreadsAwaitingCheckout(String username, String password) intintintgetNumUnclosedOrphanedConnections(String username, String password) intintintlonggetStartTimeMillis(String username, String password) longintgetStatementCacheNumCheckedOut(String username, String password) intintintgetStatementCacheNumConnectionsWithCachedStatements(String username, String password) intintintgetStatementCacheNumStatements(String username, String password) intintintintgetStatementDestroyerNumConnectionsInUse(String username, String password) intintintgetStatementDestroyerNumConnectionsWithDeferredDestroyStatements(String username, String password) intintintgetStatementDestroyerNumDeferredDestroyStatements(String username, String password) intintintintintintintintintlonggetUpTimeMillis(String username, String password) longvoidDestroys all pooled and checked-out Connections associated with this DataSource immediately.protected voidinitializeNamedConfig(String configName, boolean shouldBindUserOverridesAsString) booleanisWrapperFor(Class<?> iface) protected final booleanisWrapperForThis(Class<?> iface) voidvoidresetPoolManager(boolean close_checked_out_connections) sampleLastAcquisitionFailureStackTrace(String username, String password) sampleLastCheckinFailureStackTrace(String username, String password) sampleLastCheckoutFailureStackTrace(String username, String password) sampleLastConnectionTestFailureStackTrace(String username, String password) sampleLastIdleTestFailureStackTrace(String username, String password) sampleStatementCacheStatus(String username, String password) voidsetLoginTimeout(int seconds) voidsetLogWriter(PrintWriter out) voidDiscards all Connections managed by the PooledDataSource with the specified authentication credentials and reacquires new Connections to populate.voidDiscards all Connections managed by the PooledDataSource and reacquires new Connections to populate.voidDiscards all Connections managed by the PooledDataSource's default-authentication pool and reacquires new Connections to populate.abstract StringtoString(boolean show_config) <T> TMethods inherited from class PoolBackedDataSourceBase
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, extraToStringInfo, getConnectionPoolDataSource, getExtensions, getFactoryClassLocation, getIdentityToken, getNumHelperThreads, getParentLogger, getPropertyChangeListeners, getPropertyChangeSupport, getReference, getVetoableChangeListeners, getVetoableChangeSupport, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, setConnectionPoolDataSource, setDataSourceName, setExtensions, setFactoryClassLocation, setIdentityToken, setNumHelperThreads, toStringMethods inherited from class IdentityTokenResolvable
doResolve, readResolve, verifyResolveMethods inherited from class AbstractIdentityTokenized
equals, hashCodeMethods inherited from interface CommonDataSource
createShardingKeyBuilder, getParentLoggerMethods inherited from interface DataSource
createConnectionBuilderMethods inherited from interface PooledDataSource
getExtensions, getIdentityToken, getNumHelperThreads, setDataSourceName, setExtensions
-
Constructor Details
-
AbstractPoolBackedDataSource
protected AbstractPoolBackedDataSource(boolean autoregister)
-
-
Method Details
-
initializeNamedConfig
-
getDataSourceName
- Specified by:
getDataSourceNamein interfacePooledDataSource- Overrides:
getDataSourceNamein classPoolBackedDataSourceBase
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getNumConnections
- Specified by:
getNumConnectionsin interfacePooledDataSource- Throws:
SQLException
-
getNumIdleConnections
- Specified by:
getNumIdleConnectionsin interfacePooledDataSource- Throws:
SQLException
-
getNumBusyConnections
- Specified by:
getNumBusyConnectionsin interfacePooledDataSource- Throws:
SQLException
-
getNumUnclosedOrphanedConnections
- Specified by:
getNumUnclosedOrphanedConnectionsin interfacePooledDataSource- Throws:
SQLException
-
getNumConnectionsDefaultUser
- Specified by:
getNumConnectionsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getNumIdleConnectionsDefaultUser
- Specified by:
getNumIdleConnectionsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getNumBusyConnectionsDefaultUser
- Specified by:
getNumBusyConnectionsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getNumUnclosedOrphanedConnectionsDefaultUser
- Specified by:
getNumUnclosedOrphanedConnectionsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumStatementsDefaultUser
- Specified by:
getStatementCacheNumStatementsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumCheckedOutDefaultUser
- Specified by:
getStatementCacheNumCheckedOutDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumConnectionsWithCachedStatementsDefaultUser
- Specified by:
getStatementCacheNumConnectionsWithCachedStatementsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getEffectivePropertyCycleDefaultUser
- Specified by:
getEffectivePropertyCycleDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getStartTimeMillisDefaultUser
- Specified by:
getStartTimeMillisDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getUpTimeMillisDefaultUser
- Specified by:
getUpTimeMillisDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getNumFailedCheckinsDefaultUser
- Specified by:
getNumFailedCheckinsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getNumFailedCheckoutsDefaultUser
- Specified by:
getNumFailedCheckoutsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getNumFailedIdleTestsDefaultUser
- Specified by:
getNumFailedIdleTestsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getNumThreadsAwaitingCheckoutDefaultUser
- Specified by:
getNumThreadsAwaitingCheckoutDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getThreadPoolSize
- Specified by:
getThreadPoolSizein interfacePooledDataSource- Throws:
SQLException
-
getThreadPoolNumActiveThreads
- Specified by:
getThreadPoolNumActiveThreadsin interfacePooledDataSource- Throws:
SQLException
-
getThreadPoolNumIdleThreads
- Specified by:
getThreadPoolNumIdleThreadsin interfacePooledDataSource- Throws:
SQLException
-
getThreadPoolNumTasksPending
- Specified by:
getThreadPoolNumTasksPendingin interfacePooledDataSource- Throws:
SQLException
-
sampleThreadPoolStackTraces
- Specified by:
sampleThreadPoolStackTracesin interfacePooledDataSource- Throws:
SQLException
-
sampleThreadPoolStatus
- Specified by:
sampleThreadPoolStatusin interfacePooledDataSource- Throws:
SQLException
-
sampleStatementCacheStatusDefaultUser
- Specified by:
sampleStatementCacheStatusDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
sampleStatementCacheStatus
- Specified by:
sampleStatementCacheStatusin interfacePooledDataSource- Throws:
SQLException
-
getLastAcquisitionFailureDefaultUser
- Specified by:
getLastAcquisitionFailureDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getLastCheckinFailureDefaultUser
- Specified by:
getLastCheckinFailureDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getLastCheckoutFailureDefaultUser
- Specified by:
getLastCheckoutFailureDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getLastIdleTestFailureDefaultUser
- Specified by:
getLastIdleTestFailureDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getLastConnectionTestFailureDefaultUser
- Specified by:
getLastConnectionTestFailureDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getLastAcquisitionFailure
- Specified by:
getLastAcquisitionFailurein interfacePooledDataSource- Throws:
SQLException
-
getLastCheckinFailure
- Specified by:
getLastCheckinFailurein interfacePooledDataSource- Throws:
SQLException
-
getLastCheckoutFailure
- Specified by:
getLastCheckoutFailurein interfacePooledDataSource- Throws:
SQLException
-
getLastIdleTestFailure
- Specified by:
getLastIdleTestFailurein interfacePooledDataSource- Throws:
SQLException
-
getLastConnectionTestFailure
- Specified by:
getLastConnectionTestFailurein interfacePooledDataSource- Throws:
SQLException
-
getNumThreadsAwaitingCheckout
- Specified by:
getNumThreadsAwaitingCheckoutin interfacePooledDataSource- Throws:
SQLException
-
sampleLastAcquisitionFailureStackTraceDefaultUser
- Specified by:
sampleLastAcquisitionFailureStackTraceDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
sampleLastCheckinFailureStackTraceDefaultUser
- Specified by:
sampleLastCheckinFailureStackTraceDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
sampleLastCheckoutFailureStackTraceDefaultUser
- Specified by:
sampleLastCheckoutFailureStackTraceDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
sampleLastIdleTestFailureStackTraceDefaultUser
- Specified by:
sampleLastIdleTestFailureStackTraceDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
sampleLastConnectionTestFailureStackTraceDefaultUser
- Specified by:
sampleLastConnectionTestFailureStackTraceDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
sampleLastAcquisitionFailureStackTrace
public String sampleLastAcquisitionFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastAcquisitionFailureStackTracein interfacePooledDataSource- Throws:
SQLException
-
sampleLastCheckinFailureStackTrace
public String sampleLastCheckinFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastCheckinFailureStackTracein interfacePooledDataSource- Throws:
SQLException
-
sampleLastCheckoutFailureStackTrace
public String sampleLastCheckoutFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastCheckoutFailureStackTracein interfacePooledDataSource- Throws:
SQLException
-
sampleLastIdleTestFailureStackTrace
public String sampleLastIdleTestFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastIdleTestFailureStackTracein interfacePooledDataSource- Throws:
SQLException
-
sampleLastConnectionTestFailureStackTrace
public String sampleLastConnectionTestFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastConnectionTestFailureStackTracein interfacePooledDataSource- Throws:
SQLException
-
softResetDefaultUser
Description copied from interface:PooledDataSourceDiscards all Connections managed by the PooledDataSource's default-authentication pool and reacquires new Connections to populate. Current checked out Connections will still be valid, and should still be checked into the PooledDataSource (so the PooledDataSource can destroy them).- Specified by:
softResetDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getNumConnections
- Specified by:
getNumConnectionsin interfacePooledDataSource- Throws:
SQLException
-
getNumIdleConnections
- Specified by:
getNumIdleConnectionsin interfacePooledDataSource- Throws:
SQLException
-
getNumBusyConnections
- Specified by:
getNumBusyConnectionsin interfacePooledDataSource- Throws:
SQLException
-
getNumUnclosedOrphanedConnections
- Specified by:
getNumUnclosedOrphanedConnectionsin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumStatements
- Specified by:
getStatementCacheNumStatementsin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumCheckedOut
- Specified by:
getStatementCacheNumCheckedOutin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumConnectionsWithCachedStatements
public int getStatementCacheNumConnectionsWithCachedStatements(String username, String password) throws SQLException - Specified by:
getStatementCacheNumConnectionsWithCachedStatementsin interfacePooledDataSource- Throws:
SQLException
-
getEffectivePropertyCycle
- Specified by:
getEffectivePropertyCyclein interfacePooledDataSource- Throws:
SQLException
-
getStartTimeMillis
- Throws:
SQLException
-
getUpTimeMillis
- Throws:
SQLException
-
getNumFailedCheckins
- Throws:
SQLException
-
getNumFailedCheckouts
- Throws:
SQLException
-
getNumFailedIdleTests
- Throws:
SQLException
-
softReset
Description copied from interface:PooledDataSourceDiscards all Connections managed by the PooledDataSource with the specified authentication credentials and reacquires new Connections to populate. Current checked out Connections will still be valid, and should still be checked into the PooledDataSource (so the PooledDataSource can destroy them).- Specified by:
softResetin interfacePooledDataSource- Throws:
SQLException
-
getNumBusyConnectionsAllUsers
- Specified by:
getNumBusyConnectionsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getNumIdleConnectionsAllUsers
- Specified by:
getNumIdleConnectionsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getNumConnectionsAllUsers
- Specified by:
getNumConnectionsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getNumUnclosedOrphanedConnectionsAllUsers
- Specified by:
getNumUnclosedOrphanedConnectionsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumStatementsAllUsers
- Specified by:
getStatementCacheNumStatementsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumCheckedOutStatementsAllUsers
- Specified by:
getStatementCacheNumCheckedOutStatementsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getStatementCacheNumConnectionsWithCachedStatementsAllUsers
- Specified by:
getStatementCacheNumConnectionsWithCachedStatementsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumConnectionsInUseAllUsers
- Specified by:
getStatementDestroyerNumConnectionsInUseAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsAllUsers
public int getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsAllUsers() throws SQLException- Specified by:
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumDeferredDestroyStatementsAllUsers
- Specified by:
getStatementDestroyerNumDeferredDestroyStatementsAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumConnectionsInUseDefaultUser
- Specified by:
getStatementDestroyerNumConnectionsInUseDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsDefaultUser
public int getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsDefaultUser() throws SQLException- Specified by:
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumDeferredDestroyStatementsDefaultUser
- Specified by:
getStatementDestroyerNumDeferredDestroyStatementsDefaultUserin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumThreads
- Specified by:
getStatementDestroyerNumThreadsin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumActiveThreads
- Specified by:
getStatementDestroyerNumActiveThreadsin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumIdleThreads
- Specified by:
getStatementDestroyerNumIdleThreadsin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumTasksPending
- Specified by:
getStatementDestroyerNumTasksPendingin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumConnectionsInUse
public int getStatementDestroyerNumConnectionsInUse(String username, String password) throws SQLException - Specified by:
getStatementDestroyerNumConnectionsInUsein interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumConnectionsWithDeferredDestroyStatements
public int getStatementDestroyerNumConnectionsWithDeferredDestroyStatements(String username, String password) throws SQLException - Specified by:
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsin interfacePooledDataSource- Throws:
SQLException
-
getStatementDestroyerNumDeferredDestroyStatements
public int getStatementDestroyerNumDeferredDestroyStatements(String username, String password) throws SQLException - Specified by:
getStatementDestroyerNumDeferredDestroyStatementsin interfacePooledDataSource- Throws:
SQLException
-
sampleStatementDestroyerStackTraces
- Specified by:
sampleStatementDestroyerStackTracesin interfacePooledDataSource- Throws:
SQLException
-
sampleStatementDestroyerStatus
- Specified by:
sampleStatementDestroyerStatusin interfacePooledDataSource- Throws:
SQLException
-
softResetAllUsers
Description copied from interface:PooledDataSourceDiscards all Connections managed by the PooledDataSource and reacquires new Connections to populate. Current checked out Connections will still be valid, and should still be checked into the PooledDataSource (so the PooledDataSource can destroy them).- Specified by:
softResetAllUsersin interfacePooledDataSource- Throws:
SQLException
-
getNumUserPools
- Specified by:
getNumUserPoolsin interfacePooledDataSource- Throws:
SQLException
-
getAllUsers
- Specified by:
getAllUsersin interfacePooledDataSource- Throws:
SQLException
-
hardReset
public void hardReset()Description copied from interface:PooledDataSourceDestroys all pooled and checked-out Connections associated with this DataSource immediately. The PooledDataSource is reset to its initial state prior to first Connection acquisition, with no pools yet active, but ready for requests.- Specified by:
hardResetin interfacePooledDataSource
-
close
public void close()Description copied from interface:PooledDataSourceC3P0 pooled DataSources use no resources before they are actually used in a VM, and they close themselves in their finalize() method. When they are active and pooling, they may have open database connections and their pool may spawn several threads for its maintenance. You can use this method to clean these resource methods up quickly when you will no longer be using this DataSource. The resources will actually be cleaned up only if no other DataSources are sharing the same pool.
You can equivalently use the static method destroy() in the DataSources class to clean-up these resources.
This is equivalent to calling close( false ).
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacePooledDataSource- See Also:
-
close
public void close(boolean force_destroy) Deprecated.the force_destroy argument is now meaningless, as pools are no longer potentially shared between multiple DataSources.Description copied from interface:PooledDataSourceShould be used only with great caution. If
force_destroyis set to true, this immediately destroys any pool and cleans up all resources this DataSource may be using, even if other DataSources are sharing that pool! In general, it is difficult to know whether a pool is being shared by multiple DataSources. It may depend upon whether or not a JNDI implementation returns a single instance or multiple copies upon lookup (which is undefined by the JNDI spec).In general, this method should be used only when you wish to wind down all c3p0 pools in a ClassLoader. For example, when shutting down and restarting a web application that uses c3p0, you may wish to kill all threads making use of classes loaded by a web-app specific ClassLoader, so that the ClassLoader can be cleanly garbage collected. In this case, you may wish to use force destroy. Otherwise, it is much safer to use the simple destroy() method, which will not shut down pools that may still be in use.
To close a pool normally, use the no argument close method, or set
force_destroyto false.- Specified by:
closein interfacePooledDataSource- See Also:
-
resetPoolManager
public void resetPoolManager() -
resetPoolManager
public void resetPoolManager(boolean close_checked_out_connections) -
toString
-
isWrapperForThis
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-