Class AbstractPoolBackedDataSource
- All Implemented Interfaces:
IdentityTokenized
,PooledDataSource
,Serializable
,Wrapper
,Referenceable
,CommonDataSource
,DataSource
- Direct Known Subclasses:
AbstractComboPooledDataSource
,PoolBackedDataSource
- See Also:
-
Field Summary
Fields inherited from class com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase
pcs, vcs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
C3P0 pooled DataSources use no resources before they are actually used in a VM, and they close themselves in their finalize() method.void
close
(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) float
getEffectivePropertyCycle
(String username, String password) float
getLastAcquisitionFailure
(String username, String password) getLastCheckinFailure
(String username, String password) getLastCheckoutFailure
(String username, String password) getLastConnectionTestFailure
(String username, String password) getLastIdleTestFailure
(String username, String password) int
int
int
getNumBusyConnections
(String username, String password) int
int
int
int
getNumConnections
(String username, String password) int
int
long
getNumFailedCheckins
(String username, String password) long
long
getNumFailedCheckouts
(String username, String password) long
long
getNumFailedIdleTests
(String username, String password) long
int
int
getNumIdleConnections
(String username, String password) int
int
int
getNumThreadsAwaitingCheckout
(String username, String password) int
int
int
getNumUnclosedOrphanedConnections
(String username, String password) int
int
int
long
getStartTimeMillis
(String username, String password) long
int
getStatementCacheNumCheckedOut
(String username, String password) int
int
int
getStatementCacheNumConnectionsWithCachedStatements
(String username, String password) int
int
int
getStatementCacheNumStatements
(String username, String password) int
int
int
int
getStatementDestroyerNumConnectionsInUse
(String username, String password) int
int
int
getStatementDestroyerNumConnectionsWithDeferredDestroyStatements
(String username, String password) int
int
int
getStatementDestroyerNumDeferredDestroyStatements
(String username, String password) int
int
int
int
int
int
int
int
int
long
getUpTimeMillis
(String username, String password) long
void
Destroys all pooled and checked-out Connections associated with this DataSource immediately.protected void
initializeNamedConfig
(String configName, boolean shouldBindUserOverridesAsString) boolean
isWrapperFor
(Class<?> iface) protected final boolean
isWrapperForThis
(Class<?> iface) void
void
resetPoolManager
(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) void
setLoginTimeout
(int seconds) void
setLogWriter
(PrintWriter out) void
Discards all Connections managed by the PooledDataSource with the specified authentication credentials and reacquires new Connections to populate.void
Discards all Connections managed by the PooledDataSource and reacquires new Connections to populate.void
Discards all Connections managed by the PooledDataSource's default-authentication pool and reacquires new Connections to populate.abstract String
toString
(boolean show_config) <T> T
Methods inherited from class com.mchange.v2.c3p0.impl.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, toString
Methods inherited from class com.mchange.v2.c3p0.impl.IdentityTokenResolvable
doResolve, readResolve, verifyResolve
Methods inherited from class com.mchange.v2.c3p0.impl.AbstractIdentityTokenized
equals, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder, getParentLogger
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
Methods inherited from interface com.mchange.v2.c3p0.PooledDataSource
getExtensions, getIdentityToken, getNumHelperThreads, setDataSourceName, setExtensions
-
Constructor Details
-
AbstractPoolBackedDataSource
protected AbstractPoolBackedDataSource(boolean autoregister)
-
-
Method Details
-
initializeNamedConfig
-
getDataSourceName
- Specified by:
getDataSourceName
in interfacePooledDataSource
- Overrides:
getDataSourceName
in classPoolBackedDataSourceBase
-
getConnection
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getConnection
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getLogWriter
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- Throws:
SQLException
-
getLoginTimeout
- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
- Throws:
SQLException
-
setLoginTimeout
- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
- Throws:
SQLException
-
getNumConnections
- Specified by:
getNumConnections
in interfacePooledDataSource
- Throws:
SQLException
-
getNumIdleConnections
- Specified by:
getNumIdleConnections
in interfacePooledDataSource
- Throws:
SQLException
-
getNumBusyConnections
- Specified by:
getNumBusyConnections
in interfacePooledDataSource
- Throws:
SQLException
-
getNumUnclosedOrphanedConnections
- Specified by:
getNumUnclosedOrphanedConnections
in interfacePooledDataSource
- Throws:
SQLException
-
getNumConnectionsDefaultUser
- Specified by:
getNumConnectionsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getNumIdleConnectionsDefaultUser
- Specified by:
getNumIdleConnectionsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getNumBusyConnectionsDefaultUser
- Specified by:
getNumBusyConnectionsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getNumUnclosedOrphanedConnectionsDefaultUser
- Specified by:
getNumUnclosedOrphanedConnectionsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumStatementsDefaultUser
- Specified by:
getStatementCacheNumStatementsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumCheckedOutDefaultUser
- Specified by:
getStatementCacheNumCheckedOutDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumConnectionsWithCachedStatementsDefaultUser
- Specified by:
getStatementCacheNumConnectionsWithCachedStatementsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getEffectivePropertyCycleDefaultUser
- Specified by:
getEffectivePropertyCycleDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getStartTimeMillisDefaultUser
- Specified by:
getStartTimeMillisDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getUpTimeMillisDefaultUser
- Specified by:
getUpTimeMillisDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getNumFailedCheckinsDefaultUser
- Specified by:
getNumFailedCheckinsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getNumFailedCheckoutsDefaultUser
- Specified by:
getNumFailedCheckoutsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getNumFailedIdleTestsDefaultUser
- Specified by:
getNumFailedIdleTestsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getNumThreadsAwaitingCheckoutDefaultUser
- Specified by:
getNumThreadsAwaitingCheckoutDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getThreadPoolSize
- Specified by:
getThreadPoolSize
in interfacePooledDataSource
- Throws:
SQLException
-
getThreadPoolNumActiveThreads
- Specified by:
getThreadPoolNumActiveThreads
in interfacePooledDataSource
- Throws:
SQLException
-
getThreadPoolNumIdleThreads
- Specified by:
getThreadPoolNumIdleThreads
in interfacePooledDataSource
- Throws:
SQLException
-
getThreadPoolNumTasksPending
- Specified by:
getThreadPoolNumTasksPending
in interfacePooledDataSource
- Throws:
SQLException
-
sampleThreadPoolStackTraces
- Specified by:
sampleThreadPoolStackTraces
in interfacePooledDataSource
- Throws:
SQLException
-
sampleThreadPoolStatus
- Specified by:
sampleThreadPoolStatus
in interfacePooledDataSource
- Throws:
SQLException
-
sampleStatementCacheStatusDefaultUser
- Specified by:
sampleStatementCacheStatusDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
sampleStatementCacheStatus
- Specified by:
sampleStatementCacheStatus
in interfacePooledDataSource
- Throws:
SQLException
-
getLastAcquisitionFailureDefaultUser
- Specified by:
getLastAcquisitionFailureDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getLastCheckinFailureDefaultUser
- Specified by:
getLastCheckinFailureDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getLastCheckoutFailureDefaultUser
- Specified by:
getLastCheckoutFailureDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getLastIdleTestFailureDefaultUser
- Specified by:
getLastIdleTestFailureDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getLastConnectionTestFailureDefaultUser
- Specified by:
getLastConnectionTestFailureDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getLastAcquisitionFailure
- Specified by:
getLastAcquisitionFailure
in interfacePooledDataSource
- Throws:
SQLException
-
getLastCheckinFailure
- Specified by:
getLastCheckinFailure
in interfacePooledDataSource
- Throws:
SQLException
-
getLastCheckoutFailure
- Specified by:
getLastCheckoutFailure
in interfacePooledDataSource
- Throws:
SQLException
-
getLastIdleTestFailure
- Specified by:
getLastIdleTestFailure
in interfacePooledDataSource
- Throws:
SQLException
-
getLastConnectionTestFailure
- Specified by:
getLastConnectionTestFailure
in interfacePooledDataSource
- Throws:
SQLException
-
getNumThreadsAwaitingCheckout
- Specified by:
getNumThreadsAwaitingCheckout
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastAcquisitionFailureStackTraceDefaultUser
- Specified by:
sampleLastAcquisitionFailureStackTraceDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastCheckinFailureStackTraceDefaultUser
- Specified by:
sampleLastCheckinFailureStackTraceDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastCheckoutFailureStackTraceDefaultUser
- Specified by:
sampleLastCheckoutFailureStackTraceDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastIdleTestFailureStackTraceDefaultUser
- Specified by:
sampleLastIdleTestFailureStackTraceDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastConnectionTestFailureStackTraceDefaultUser
- Specified by:
sampleLastConnectionTestFailureStackTraceDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastAcquisitionFailureStackTrace
public String sampleLastAcquisitionFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastAcquisitionFailureStackTrace
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastCheckinFailureStackTrace
public String sampleLastCheckinFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastCheckinFailureStackTrace
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastCheckoutFailureStackTrace
public String sampleLastCheckoutFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastCheckoutFailureStackTrace
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastIdleTestFailureStackTrace
public String sampleLastIdleTestFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastIdleTestFailureStackTrace
in interfacePooledDataSource
- Throws:
SQLException
-
sampleLastConnectionTestFailureStackTrace
public String sampleLastConnectionTestFailureStackTrace(String username, String password) throws SQLException - Specified by:
sampleLastConnectionTestFailureStackTrace
in interfacePooledDataSource
- Throws:
SQLException
-
softResetDefaultUser
Description copied from interface:PooledDataSource
Discards 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:
softResetDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getNumConnections
- Specified by:
getNumConnections
in interfacePooledDataSource
- Throws:
SQLException
-
getNumIdleConnections
- Specified by:
getNumIdleConnections
in interfacePooledDataSource
- Throws:
SQLException
-
getNumBusyConnections
- Specified by:
getNumBusyConnections
in interfacePooledDataSource
- Throws:
SQLException
-
getNumUnclosedOrphanedConnections
- Specified by:
getNumUnclosedOrphanedConnections
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumStatements
- Specified by:
getStatementCacheNumStatements
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumCheckedOut
- Specified by:
getStatementCacheNumCheckedOut
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumConnectionsWithCachedStatements
public int getStatementCacheNumConnectionsWithCachedStatements(String username, String password) throws SQLException - Specified by:
getStatementCacheNumConnectionsWithCachedStatements
in interfacePooledDataSource
- Throws:
SQLException
-
getEffectivePropertyCycle
- Specified by:
getEffectivePropertyCycle
in interfacePooledDataSource
- Throws:
SQLException
-
getStartTimeMillis
- Throws:
SQLException
-
getUpTimeMillis
- Throws:
SQLException
-
getNumFailedCheckins
- Throws:
SQLException
-
getNumFailedCheckouts
- Throws:
SQLException
-
getNumFailedIdleTests
- Throws:
SQLException
-
softReset
Description copied from interface:PooledDataSource
Discards 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:
softReset
in interfacePooledDataSource
- Throws:
SQLException
-
getNumBusyConnectionsAllUsers
- Specified by:
getNumBusyConnectionsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getNumIdleConnectionsAllUsers
- Specified by:
getNumIdleConnectionsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getNumConnectionsAllUsers
- Specified by:
getNumConnectionsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getNumUnclosedOrphanedConnectionsAllUsers
- Specified by:
getNumUnclosedOrphanedConnectionsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumStatementsAllUsers
- Specified by:
getStatementCacheNumStatementsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumCheckedOutStatementsAllUsers
- Specified by:
getStatementCacheNumCheckedOutStatementsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementCacheNumConnectionsWithCachedStatementsAllUsers
- Specified by:
getStatementCacheNumConnectionsWithCachedStatementsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumConnectionsInUseAllUsers
- Specified by:
getStatementDestroyerNumConnectionsInUseAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsAllUsers
public int getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsAllUsers() throws SQLException- Specified by:
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumDeferredDestroyStatementsAllUsers
- Specified by:
getStatementDestroyerNumDeferredDestroyStatementsAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumConnectionsInUseDefaultUser
- Specified by:
getStatementDestroyerNumConnectionsInUseDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsDefaultUser
public int getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsDefaultUser() throws SQLException- Specified by:
getStatementDestroyerNumConnectionsWithDeferredDestroyStatementsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumDeferredDestroyStatementsDefaultUser
- Specified by:
getStatementDestroyerNumDeferredDestroyStatementsDefaultUser
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumThreads
- Specified by:
getStatementDestroyerNumThreads
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumActiveThreads
- Specified by:
getStatementDestroyerNumActiveThreads
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumIdleThreads
- Specified by:
getStatementDestroyerNumIdleThreads
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumTasksPending
- Specified by:
getStatementDestroyerNumTasksPending
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumConnectionsInUse
public int getStatementDestroyerNumConnectionsInUse(String username, String password) throws SQLException - Specified by:
getStatementDestroyerNumConnectionsInUse
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumConnectionsWithDeferredDestroyStatements
public int getStatementDestroyerNumConnectionsWithDeferredDestroyStatements(String username, String password) throws SQLException - Specified by:
getStatementDestroyerNumConnectionsWithDeferredDestroyStatements
in interfacePooledDataSource
- Throws:
SQLException
-
getStatementDestroyerNumDeferredDestroyStatements
public int getStatementDestroyerNumDeferredDestroyStatements(String username, String password) throws SQLException - Specified by:
getStatementDestroyerNumDeferredDestroyStatements
in interfacePooledDataSource
- Throws:
SQLException
-
sampleStatementDestroyerStackTraces
- Specified by:
sampleStatementDestroyerStackTraces
in interfacePooledDataSource
- Throws:
SQLException
-
sampleStatementDestroyerStatus
- Specified by:
sampleStatementDestroyerStatus
in interfacePooledDataSource
- Throws:
SQLException
-
softResetAllUsers
Description copied from interface:PooledDataSource
Discards 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:
softResetAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
getNumUserPools
- Specified by:
getNumUserPools
in interfacePooledDataSource
- Throws:
SQLException
-
getAllUsers
- Specified by:
getAllUsers
in interfacePooledDataSource
- Throws:
SQLException
-
hardReset
public void hardReset()Description copied from interface:PooledDataSource
Destroys 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:
hardReset
in interfacePooledDataSource
-
close
public void close()Description copied from interface:PooledDataSource
C3P0 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:
close
in 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:PooledDataSource
Should be used only with great caution. If force_destroy is 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_destroy to false.
- Specified by:
close
in interfacePooledDataSource
- See Also:
-
resetPoolManager
public void resetPoolManager() -
resetPoolManager
public void resetPoolManager(boolean close_checked_out_connections) -
toString
-
isWrapperForThis
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-