Package com.alibaba.druid.pool
Class DruidAbstractDataSource
java.lang.Object
com.alibaba.druid.pool.WrapperAdapter
com.alibaba.druid.pool.DruidAbstractDataSource
- All Implemented Interfaces:
DruidAbstractDataSourceMBean
,DataSourceProxy
,Serializable
,Wrapper
,CommonDataSource
,DataSource
- Direct Known Subclasses:
DruidDataSource
public abstract class DruidAbstractDataSource
extends WrapperAdapter
implements DruidAbstractDataSourceMBean, DataSource, DataSourceProxy, Serializable
- Author:
- wenshao [[email protected]], ljw [[email protected]]
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected ReentrantLock
protected final Map<DruidPooledConnection,
Object> protected boolean
protected boolean
protected long
protected long
protected long
protected long
protected long
protected long
protected int
protected long
protected Properties
protected int
protected long
protected final Date
protected Throwable
protected int
protected ScheduledExecutorService
protected long
protected long
protected int
protected String
static final int
static final int
static final long
static final int
static final int
static final long
static final int
static final int
static final long
static final boolean
static final boolean
static final long
static final long
static final int
static final int
static final String
static final boolean
protected boolean
protected String
protected Boolean
protected Integer
protected long
protected ScheduledExecutorService
protected int
protected Driver
protected String
protected ClassLoader
protected long
protected Condition
protected long
protected ExceptionSorter
protected long
protected long
protected long
protected long
protected int
protected long
protected boolean
protected int
protected int
protected static final AtomicReferenceFieldUpdater<DruidAbstractDataSource,
FilterChainImpl> protected long
protected boolean
protected Date
protected boolean
protected boolean
protected int
protected boolean
protected boolean
protected boolean
protected String
protected long
protected Throwable
protected Throwable
protected long
protected long
protected Throwable
protected long
protected Throwable
protected String
protected long
protected ReentrantLock
protected boolean
protected PrintWriter
protected int
protected int
protected long
protected int
protected int
protected int
protected long
protected int
protected long
protected long
protected int
protected String
protected boolean
protected Executor
protected Condition
protected int
protected int
protected boolean
protected int
protected String
protected PasswordCallback
protected long
protected long
protected boolean
protected long
protected static final Object
protected int
protected boolean
protected long
protected long
protected long
protected boolean
protected int
protected long
protected long
protected DruidDataSourceStatLogger
protected boolean
protected boolean
protected boolean
protected long
protected long
protected long
protected final Histogram
protected long
protected int
protected long
protected boolean
protected boolean
protected NameCallback
protected String
protected String
protected int
protected ValidConnectionChecker
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConnectionProperty
(String name, String value) void
addFilters
(String filters) void
protected void
void
closePreapredStatement
(PreparedStatementHolder stmtHolder) protected FilterChainImpl
long
long
createPhysicalConnection
(String url, Properties info) long
long
long
void
void
abstract void
discardConnection
(Connection realConnection) abstract int
long
long
long
long
long
long
long
long
int
int
long
long
long
long
int
int
long
long
long
long
long
long
String[]
long
getID()
int
long
long
long
int
int
int
long
int
int
int
long
int
long
int
getName()
int
int
int
long
long
long
abstract String
int
Retrieves the number of seconds the driver will wait for aStatement
object to execute.abstract int
abstract int
int
long
long
int
long
long
long
long
long[]
long[]
int
long
getUrl()
int
void
abstract void
handleConnectionException
(DruidPooledConnection conn, Throwable t, String sql) void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
initPhysicalConnection
(Connection conn, Map<String, Object> variables, Map<String, Object> globalVariables) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isInited()
boolean
boolean
boolean
boolean
boolean
boolean
isOracle()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
abstract void
protected abstract void
recycle
(DruidPooledConnection pooledConnection) protected void
void
setAccessToUnderlyingConnectionAllowed
(boolean accessToUnderlyingConnectionAllowed) void
setAsyncCloseConnectionEnable
(boolean asyncCloseConnectionEnable) void
setBreakAfterAcquireFailure
(boolean breakAfterAcquireFailure) void
setClearFiltersEnable
(boolean clearFiltersEnable) void
setConnectionErrorRetryAttempts
(int connectionErrorRetryAttempts) void
setConnectionInitSqls
(Collection<? extends Object> connectionInitSqls) void
setConnectionProperties
(String connectionProperties) abstract void
setConnectProperties
(Properties properties) void
setConnectTimeout
(int milliSeconds) protected void
setConnectTimeout
(String milliSeconds) protected void
void
setCreateScheduler
(ScheduledExecutorService createScheduler) void
void
void
setDefaultAutoCommit
(boolean defaultAutoCommit) void
setDefaultCatalog
(String defaultCatalog) void
setDefaultReadOnly
(Boolean defaultReadOnly) void
setDefaultTransactionIsolation
(Integer defaultTransactionIsolation) void
setDestroyScheduler
(ScheduledExecutorService destroyScheduler) void
void
setDriverClassLoader
(ClassLoader driverClassLoader) void
setDriverClassName
(String driverClass) void
setDupCloseLogEnable
(boolean dupCloseLogEnable) void
setExceptionSorter
(ExceptionSorter exceptionSoter) void
setExceptionSorter
(String exceptionSorter) void
setExceptionSorterClassName
(String exceptionSorter) protected void
setFailContinuous
(boolean fail) void
setFailFast
(boolean failFast) void
setFilters
(String filters) void
setInitExceptionThrow
(boolean initExceptionThrow) void
setInitGlobalVariants
(boolean initGlobalVariants) void
setInitialSize
(int initialSize) void
setInitVariants
(boolean initVariants) void
setKeepAliveBetweenTimeMillis
(long keepAliveBetweenTimeMillis) void
setLogAbandoned
(boolean logAbandoned) void
setLoginTimeout
(int seconds) void
setLogWriter
(PrintWriter out) abstract void
setMaxActive
(int maxActive) void
setMaxCreateTaskCount
(int maxCreateTaskCount) void
setMaxEvictableIdleTimeMillis
(long maxEvictableIdleTimeMillis) void
setMaxIdle
(int maxIdle) Deprecated.void
setMaxOpenPreparedStatements
(int maxOpenPreparedStatements) void
setMaxPoolPreparedStatementPerConnectionSize
(int maxPoolPreparedStatementPerConnectionSize) void
setMaxWait
(long maxWaitMillis) void
setMaxWaitThreadCount
(int maxWaithThreadCount) void
setMinEvictableIdleTimeMillis
(long minEvictableIdleTimeMillis) void
setMinIdle
(int value) void
void
setNotFullTimeoutRetryCount
(int notFullTimeoutRetryCount) void
setNumTestsPerEvictionRun
(int numTestsPerEvictionRun) Deprecated.void
setObjectName
(ObjectName objectName) void
setOnFatalErrorMaxActive
(int onFatalErrorMaxActive) void
setOracle
(boolean isOracle) void
setPassword
(String password) void
setPasswordCallback
(PasswordCallback passwordCallback) void
setPasswordCallbackClassName
(String passwordCallbackClassName) void
setPhyMaxUseCount
(long phyMaxUseCount) void
setPhyTimeoutMillis
(long phyTimeoutMillis) abstract void
setPoolPreparedStatements
(boolean value) void
setProxyFilters
(List<Filter> filters) void
setQueryTimeout
(int seconds) Sets the number of seconds the driver will wait for aStatement
object to execute to the given number of seconds.void
setRemoveAbandoned
(boolean removeAbandoned) void
setRemoveAbandonedTimeout
(int removeAbandonedTimeout) void
setRemoveAbandonedTimeoutMillis
(long removeAbandonedTimeoutMillis) void
setSharePreparedStatements
(boolean sharePreparedStatements) void
setSocketTimeout
(int milliSeconds) protected void
setSocketTimeout
(String milliSeconds) void
setStatLogger
(DruidDataSourceStatLogger statLogger) void
setStatLoggerClassName
(String className) void
setTestOnBorrow
(boolean testOnBorrow) void
setTestOnReturn
(boolean testOnReturn) void
setTestWhileIdle
(boolean testWhileIdle) void
setTimeBetweenConnectErrorMillis
(long timeBetweenConnectErrorMillis) void
setTimeBetweenEvictionRunsMillis
(long timeBetweenEvictionRunsMillis) void
setTimeBetweenLogStatsMillis
(long timeBetweenLogStatsMillis) void
setTransactionQueryTimeout
(int transactionQueryTimeout) void
setTransactionThresholdMillis
(long transactionThresholdMillis) void
void
setUseLocalSessionState
(boolean useLocalSessionState) void
setUseOracleImplicitCache
(boolean useOracleImplicitCache) void
setUsePingMethod
(boolean usePingMethod) void
setUserCallback
(NameCallback userCallback) void
setUsername
(String username) void
setUseUnfairLock
(boolean useUnfairLock) void
setValidationQuery
(String validationQuery) void
setValidationQueryTimeout
(int validationQueryTimeout) void
setValidConnectionChecker
(ValidConnectionChecker validConnectionChecker) void
setValidConnectionCheckerClassName
(String validConnectionCheckerClass) protected boolean
testConnectionInternal
(DruidConnectionHolder holder, Connection conn) protected boolean
Deprecated.void
validateConnection
(Connection conn) Methods inherited from class com.alibaba.druid.pool.WrapperAdapter
isWrapperFor, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder, getConnection, getConnection
Methods inherited from interface com.alibaba.druid.proxy.jdbc.DataSourceProxy
getDataSourceStat
Methods inherited from interface com.alibaba.druid.pool.DruidAbstractDataSourceMBean
getActiveCount, getCloseCount, getConnectCount, getConnectErrorCount, getCreateCount, getDestroyCount, getFilterClassNames, getPoolingCount, getRecycleCount, getRemoveAbandonedCount
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Field Details
-
DEFAULT_INITIAL_SIZE
public static final int DEFAULT_INITIAL_SIZE- See Also:
-
DEFAULT_MAX_ACTIVE_SIZE
public static final int DEFAULT_MAX_ACTIVE_SIZE- See Also:
-
DEFAULT_MAX_IDLE
public static final int DEFAULT_MAX_IDLE- See Also:
-
DEFAULT_MIN_IDLE
public static final int DEFAULT_MIN_IDLE- See Also:
-
DEFAULT_MAX_WAIT
public static final int DEFAULT_MAX_WAIT- See Also:
-
DEFAULT_VALIDATION_QUERY
-
DEFAULT_TEST_ON_BORROW
public static final boolean DEFAULT_TEST_ON_BORROW- See Also:
-
DEFAULT_TEST_ON_RETURN
public static final boolean DEFAULT_TEST_ON_RETURN- See Also:
-
DEFAULT_WHILE_IDLE
public static final boolean DEFAULT_WHILE_IDLE- See Also:
-
DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS- See Also:
-
DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS
public static final long DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS- See Also:
-
DEFAULT_NUM_TESTS_PER_EVICTION_RUN
public static final int DEFAULT_NUM_TESTS_PER_EVICTION_RUN- See Also:
-
DEFAULT_TIME_CONNECT_TIMEOUT_MILLIS
public static final int DEFAULT_TIME_CONNECT_TIMEOUT_MILLIS- See Also:
-
DEFAULT_TIME_SOCKET_TIMEOUT_MILLIS
public static final int DEFAULT_TIME_SOCKET_TIMEOUT_MILLIS- See Also:
-
DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS- See Also:
-
DEFAULT_MAX_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_MAX_EVICTABLE_IDLE_TIME_MILLIS- See Also:
-
DEFAULT_PHY_TIMEOUT_MILLIS
public static final long DEFAULT_PHY_TIMEOUT_MILLIS- See Also:
-
defaultAutoCommit
protected volatile boolean defaultAutoCommit -
defaultReadOnly
-
defaultTransactionIsolation
-
defaultCatalog
-
name
-
username
-
password
-
jdbcUrl
-
driverClass
-
driverClassLoader
-
connectProperties
-
passwordCallback
-
userCallback
-
initialSize
protected volatile int initialSize -
maxActive
protected volatile int maxActive -
minIdle
protected volatile int minIdle -
maxIdle
protected volatile int maxIdle -
maxWait
protected volatile long maxWait -
notFullTimeoutRetryCount
protected int notFullTimeoutRetryCount -
validationQuery
-
validationQueryTimeout
protected volatile int validationQueryTimeout -
testOnBorrow
protected volatile boolean testOnBorrow -
testOnReturn
protected volatile boolean testOnReturn -
testWhileIdle
protected volatile boolean testWhileIdle -
poolPreparedStatements
protected volatile boolean poolPreparedStatements -
maxPoolPreparedStatementPerConnectionSize
protected volatile int maxPoolPreparedStatementPerConnectionSize -
inited
protected volatile boolean inited -
initExceptionThrow
protected volatile boolean initExceptionThrow -
logWriter
-
filters
-
exceptionSorter
-
driver
-
connectTimeout
protected volatile int connectTimeout -
socketTimeout
protected volatile int socketTimeout -
queryTimeout
protected volatile int queryTimeout -
transactionQueryTimeout
protected volatile int transactionQueryTimeout -
createTimespan
protected long createTimespan -
maxWaitThreadCount
protected volatile int maxWaitThreadCount -
accessToUnderlyingConnectionAllowed
protected volatile boolean accessToUnderlyingConnectionAllowed -
timeBetweenEvictionRunsMillis
protected volatile long timeBetweenEvictionRunsMillis -
numTestsPerEvictionRun
protected volatile int numTestsPerEvictionRun -
minEvictableIdleTimeMillis
protected volatile long minEvictableIdleTimeMillis -
maxEvictableIdleTimeMillis
protected volatile long maxEvictableIdleTimeMillis -
keepAliveBetweenTimeMillis
protected volatile long keepAliveBetweenTimeMillis -
phyTimeoutMillis
protected volatile long phyTimeoutMillis -
phyMaxUseCount
protected volatile long phyMaxUseCount -
removeAbandoned
protected volatile boolean removeAbandoned -
removeAbandonedTimeoutMillis
protected volatile long removeAbandonedTimeoutMillis -
logAbandoned
protected volatile boolean logAbandoned -
maxOpenPreparedStatements
protected volatile int maxOpenPreparedStatements -
connectionInitSqls
-
dbTypeName
-
timeBetweenConnectErrorMillis
protected volatile long timeBetweenConnectErrorMillis -
validConnectionChecker
-
usePingMethod
protected volatile boolean usePingMethod -
activeConnections
-
PRESENT
-
id
protected long id -
connectionErrorRetryAttempts
protected int connectionErrorRetryAttempts -
breakAfterAcquireFailure
protected boolean breakAfterAcquireFailure -
transactionThresholdMillis
protected long transactionThresholdMillis -
createdTime
-
initedTime
-
errorCount
protected volatile long errorCount -
dupCloseCount
protected volatile long dupCloseCount -
startTransactionCount
protected volatile long startTransactionCount -
commitCount
protected volatile long commitCount -
rollbackCount
protected volatile long rollbackCount -
cachedPreparedStatementHitCount
protected volatile long cachedPreparedStatementHitCount -
preparedStatementCount
protected volatile long preparedStatementCount -
closedPreparedStatementCount
protected volatile long closedPreparedStatementCount -
cachedPreparedStatementCount
protected volatile long cachedPreparedStatementCount -
cachedPreparedStatementDeleteCount
protected volatile long cachedPreparedStatementDeleteCount -
cachedPreparedStatementMissCount
protected volatile long cachedPreparedStatementMissCount -
filterChainUpdater
protected static final AtomicReferenceFieldUpdater<DruidAbstractDataSource,FilterChainImpl> filterChainUpdater -
transactionHistogram
-
executeCount
protected volatile long executeCount -
executeQueryCount
protected volatile long executeQueryCount -
executeUpdateCount
protected volatile long executeUpdateCount -
executeBatchCount
protected volatile long executeBatchCount -
createError
-
lastError
-
lastErrorTimeMillis
protected volatile long lastErrorTimeMillis -
lastCreateError
-
lastCreateErrorTimeMillis
protected volatile long lastCreateErrorTimeMillis -
lastCreateStartTimeMillis
protected volatile long lastCreateStartTimeMillis -
isOracle
protected boolean isOracle -
isMySql
protected boolean isMySql -
useOracleImplicitCache
protected boolean useOracleImplicitCache -
lock
-
notEmpty
-
empty
-
activeConnectionLock
-
createErrorCount
protected volatile int createErrorCount -
creatingCount
protected volatile int creatingCount -
directCreateCount
protected volatile int directCreateCount -
createCount
protected volatile long createCount -
destroyCount
protected volatile long destroyCount -
createStartNanos
protected volatile long createStartNanos -
timeBetweenLogStatsMillis
protected long timeBetweenLogStatsMillis -
statLogger
-
asyncCloseConnectionEnable
protected boolean asyncCloseConnectionEnable -
maxCreateTaskCount
protected int maxCreateTaskCount -
failFast
protected boolean failFast -
failContinuous
protected volatile int failContinuous -
failContinuousTimeMillis
protected volatile long failContinuousTimeMillis -
destroyScheduler
-
createScheduler
-
netTimeoutExecutor
-
netTimeoutError
protected volatile boolean netTimeoutError -
initVariants
protected boolean initVariants -
initGlobalVariants
protected boolean initGlobalVariants -
onFatalError
protected volatile boolean onFatalError -
onFatalErrorMaxActive
protected volatile int onFatalErrorMaxActive -
fatalErrorCount
protected volatile int fatalErrorCount -
fatalErrorCountLastShrink
protected volatile int fatalErrorCountLastShrink -
lastFatalErrorTimeMillis
protected volatile long lastFatalErrorTimeMillis -
lastFatalErrorSql
-
lastFatalError
-
keepAliveError
-
connectionIdSeed
protected volatile long connectionIdSeed -
statementIdSeed
protected volatile long statementIdSeed -
resultSetIdSeed
protected volatile long resultSetIdSeed -
transactionIdSeed
protected volatile long transactionIdSeed -
metaDataIdSeed
protected volatile long metaDataIdSeed
-
-
Constructor Details
-
DruidAbstractDataSource
public DruidAbstractDataSource(boolean lockFair)
-
-
Method Details
-
createChain
-
recycleFilterChain
-
isUseLocalSessionState
public boolean isUseLocalSessionState() -
setUseLocalSessionState
public void setUseLocalSessionState(boolean useLocalSessionState) -
getStatLogger
-
setStatLoggerClassName
-
setStatLogger
-
getTimeBetweenLogStatsMillis
public long getTimeBetweenLogStatsMillis() -
setTimeBetweenLogStatsMillis
public void setTimeBetweenLogStatsMillis(long timeBetweenLogStatsMillis) -
isOracle
public boolean isOracle() -
setOracle
public void setOracle(boolean isOracle) -
isUseUnfairLock
public boolean isUseUnfairLock() -
setUseUnfairLock
public void setUseUnfairLock(boolean useUnfairLock) -
isUseOracleImplicitCache
public boolean isUseOracleImplicitCache()- Specified by:
isUseOracleImplicitCache
in interfaceDruidAbstractDataSourceMBean
-
setUseOracleImplicitCache
public void setUseOracleImplicitCache(boolean useOracleImplicitCache) - Specified by:
setUseOracleImplicitCache
in interfaceDruidAbstractDataSourceMBean
-
getLastCreateError
-
getLastError
-
getLastErrorTimeMillis
public long getLastErrorTimeMillis() -
getLastErrorTime
-
getLastCreateErrorTimeMillis
public long getLastCreateErrorTimeMillis() -
getLastCreateErrorTime
-
getTransactionQueryTimeout
public int getTransactionQueryTimeout()- Specified by:
getTransactionQueryTimeout
in interfaceDruidAbstractDataSourceMBean
-
setTransactionQueryTimeout
public void setTransactionQueryTimeout(int transactionQueryTimeout) -
getExecuteCount
public long getExecuteCount() -
getExecuteUpdateCount
public long getExecuteUpdateCount() -
getExecuteQueryCount
public long getExecuteQueryCount() -
getExecuteBatchCount
public long getExecuteBatchCount() -
getAndResetExecuteCount
public long getAndResetExecuteCount() -
getExecuteCount2
public long getExecuteCount2() -
incrementExecuteCount
public void incrementExecuteCount() -
incrementExecuteUpdateCount
public void incrementExecuteUpdateCount() -
incrementExecuteQueryCount
public void incrementExecuteQueryCount() -
incrementExecuteBatchCount
public void incrementExecuteBatchCount() -
isDupCloseLogEnable
public boolean isDupCloseLogEnable() -
setDupCloseLogEnable
public void setDupCloseLogEnable(boolean dupCloseLogEnable) -
getObjectName
-
setObjectName
-
getTransactionHistogram
-
incrementCachedPreparedStatementCount
public void incrementCachedPreparedStatementCount() -
decrementCachedPreparedStatementCount
public void decrementCachedPreparedStatementCount() -
incrementCachedPreparedStatementDeleteCount
public void incrementCachedPreparedStatementDeleteCount() -
incrementCachedPreparedStatementMissCount
public void incrementCachedPreparedStatementMissCount() -
getCachedPreparedStatementMissCount
public long getCachedPreparedStatementMissCount()- Specified by:
getCachedPreparedStatementMissCount
in interfaceDruidAbstractDataSourceMBean
-
getCachedPreparedStatementAccessCount
public long getCachedPreparedStatementAccessCount()- Specified by:
getCachedPreparedStatementAccessCount
in interfaceDruidAbstractDataSourceMBean
-
getCachedPreparedStatementDeleteCount
public long getCachedPreparedStatementDeleteCount()- Specified by:
getCachedPreparedStatementDeleteCount
in interfaceDruidAbstractDataSourceMBean
-
getCachedPreparedStatementCount
public long getCachedPreparedStatementCount()- Specified by:
getCachedPreparedStatementCount
in interfaceDruidAbstractDataSourceMBean
-
incrementClosedPreparedStatementCount
public void incrementClosedPreparedStatementCount() -
getClosedPreparedStatementCount
public long getClosedPreparedStatementCount()- Specified by:
getClosedPreparedStatementCount
in interfaceDruidAbstractDataSourceMBean
-
incrementPreparedStatementCount
public void incrementPreparedStatementCount() -
getPreparedStatementCount
public long getPreparedStatementCount()- Specified by:
getPreparedStatementCount
in interfaceDruidAbstractDataSourceMBean
-
incrementCachedPreparedStatementHitCount
public void incrementCachedPreparedStatementHitCount() -
getCachedPreparedStatementHitCount
public long getCachedPreparedStatementHitCount()- Specified by:
getCachedPreparedStatementHitCount
in interfaceDruidAbstractDataSourceMBean
-
getTransactionThresholdMillis
public long getTransactionThresholdMillis()- Specified by:
getTransactionThresholdMillis
in interfaceDruidAbstractDataSourceMBean
-
setTransactionThresholdMillis
public void setTransactionThresholdMillis(long transactionThresholdMillis) - Specified by:
setTransactionThresholdMillis
in interfaceDruidAbstractDataSourceMBean
-
logTransaction
-
getTransactionHistogramValues
public long[] getTransactionHistogramValues()- Specified by:
getTransactionHistogramValues
in interfaceDruidAbstractDataSourceMBean
-
getTransactionHistogramRanges
public long[] getTransactionHistogramRanges() -
getCommitCount
public long getCommitCount()- Specified by:
getCommitCount
in interfaceDruidAbstractDataSourceMBean
-
incrementCommitCount
public void incrementCommitCount() -
getRollbackCount
public long getRollbackCount()- Specified by:
getRollbackCount
in interfaceDruidAbstractDataSourceMBean
-
incrementRollbackCount
public void incrementRollbackCount() -
getStartTransactionCount
public long getStartTransactionCount()- Specified by:
getStartTransactionCount
in interfaceDruidAbstractDataSourceMBean
-
incrementStartTransactionCount
public void incrementStartTransactionCount() -
isBreakAfterAcquireFailure
public boolean isBreakAfterAcquireFailure()- Specified by:
isBreakAfterAcquireFailure
in interfaceDruidAbstractDataSourceMBean
-
setBreakAfterAcquireFailure
public void setBreakAfterAcquireFailure(boolean breakAfterAcquireFailure) -
getConnectionErrorRetryAttempts
public int getConnectionErrorRetryAttempts()- Specified by:
getConnectionErrorRetryAttempts
in interfaceDruidAbstractDataSourceMBean
-
setConnectionErrorRetryAttempts
public void setConnectionErrorRetryAttempts(int connectionErrorRetryAttempts) -
getDupCloseCount
public long getDupCloseCount()- Specified by:
getDupCloseCount
in interfaceDruidAbstractDataSourceMBean
-
getMaxPoolPreparedStatementPerConnectionSize
public int getMaxPoolPreparedStatementPerConnectionSize()- Specified by:
getMaxPoolPreparedStatementPerConnectionSize
in interfaceDruidAbstractDataSourceMBean
-
setMaxPoolPreparedStatementPerConnectionSize
public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) - Specified by:
setMaxPoolPreparedStatementPerConnectionSize
in interfaceDruidAbstractDataSourceMBean
-
incrementDupCloseCount
public void incrementDupCloseCount() -
getValidConnectionChecker
-
setValidConnectionChecker
-
isUsePingMethod
public boolean isUsePingMethod() -
setUsePingMethod
public void setUsePingMethod(boolean usePingMethod) -
getValidConnectionCheckerClassName
- Specified by:
getValidConnectionCheckerClassName
in interfaceDruidAbstractDataSourceMBean
-
setValidConnectionCheckerClassName
- Throws:
Exception
-
getDbType
- Specified by:
getDbType
in interfaceDataSourceProxy
- Specified by:
getDbType
in interfaceDruidAbstractDataSourceMBean
-
setDbType
-
setDbType
-
addConnectionProperty
-
getConnectionInitSqls
-
setConnectionInitSqls
-
getTimeBetweenConnectErrorMillis
public long getTimeBetweenConnectErrorMillis()- Specified by:
getTimeBetweenConnectErrorMillis
in interfaceDruidAbstractDataSourceMBean
-
setTimeBetweenConnectErrorMillis
public void setTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis) -
getMaxOpenPreparedStatements
public int getMaxOpenPreparedStatements()- Specified by:
getMaxOpenPreparedStatements
in interfaceDruidAbstractDataSourceMBean
-
setMaxOpenPreparedStatements
public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements) -
isLogAbandoned
public boolean isLogAbandoned()- Specified by:
isLogAbandoned
in interfaceDruidAbstractDataSourceMBean
-
setLogAbandoned
public void setLogAbandoned(boolean logAbandoned) - Specified by:
setLogAbandoned
in interfaceDruidAbstractDataSourceMBean
-
getRemoveAbandonedTimeout
public int getRemoveAbandonedTimeout() -
setRemoveAbandonedTimeout
public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) -
setRemoveAbandonedTimeoutMillis
public void setRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis) -
getRemoveAbandonedTimeoutMillis
public long getRemoveAbandonedTimeoutMillis()- Specified by:
getRemoveAbandonedTimeoutMillis
in interfaceDruidAbstractDataSourceMBean
-
isRemoveAbandoned
public boolean isRemoveAbandoned()- Specified by:
isRemoveAbandoned
in interfaceDruidAbstractDataSourceMBean
-
setRemoveAbandoned
public void setRemoveAbandoned(boolean removeAbandoned) -
getMinEvictableIdleTimeMillis
public long getMinEvictableIdleTimeMillis()- Specified by:
getMinEvictableIdleTimeMillis
in interfaceDruidAbstractDataSourceMBean
-
setMinEvictableIdleTimeMillis
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) -
getKeepAliveBetweenTimeMillis
public long getKeepAliveBetweenTimeMillis() -
setKeepAliveBetweenTimeMillis
public void setKeepAliveBetweenTimeMillis(long keepAliveBetweenTimeMillis) -
getMaxEvictableIdleTimeMillis
public long getMaxEvictableIdleTimeMillis() -
setMaxEvictableIdleTimeMillis
public void setMaxEvictableIdleTimeMillis(long maxEvictableIdleTimeMillis) -
getPhyTimeoutMillis
public long getPhyTimeoutMillis() -
setPhyTimeoutMillis
public void setPhyTimeoutMillis(long phyTimeoutMillis) -
getPhyMaxUseCount
public long getPhyMaxUseCount() -
setPhyMaxUseCount
public void setPhyMaxUseCount(long phyMaxUseCount) -
getNumTestsPerEvictionRun
public int getNumTestsPerEvictionRun() -
setNumTestsPerEvictionRun
Deprecated.- Parameters:
numTestsPerEvictionRun
-
-
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()- Specified by:
getTimeBetweenEvictionRunsMillis
in interfaceDruidAbstractDataSourceMBean
-
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) -
getMaxWaitThreadCount
public int getMaxWaitThreadCount()- Specified by:
getMaxWaitThreadCount
in interfaceDruidAbstractDataSourceMBean
-
setMaxWaitThreadCount
public void setMaxWaitThreadCount(int maxWaithThreadCount) -
getValidationQuery
- Specified by:
getValidationQuery
in interfaceDruidAbstractDataSourceMBean
-
setValidationQuery
-
getValidationQueryTimeout
public int getValidationQueryTimeout()- Specified by:
getValidationQueryTimeout
in interfaceDruidAbstractDataSourceMBean
-
setValidationQueryTimeout
public void setValidationQueryTimeout(int validationQueryTimeout) -
isAccessToUnderlyingConnectionAllowed
public boolean isAccessToUnderlyingConnectionAllowed() -
setAccessToUnderlyingConnectionAllowed
public void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed) -
isTestOnBorrow
public boolean isTestOnBorrow()- Specified by:
isTestOnBorrow
in interfaceDruidAbstractDataSourceMBean
-
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow) - Specified by:
setTestOnBorrow
in interfaceDruidAbstractDataSourceMBean
-
isTestOnReturn
public boolean isTestOnReturn()- Specified by:
isTestOnReturn
in interfaceDruidAbstractDataSourceMBean
-
setTestOnReturn
public void setTestOnReturn(boolean testOnReturn) -
isTestWhileIdle
public boolean isTestWhileIdle()- Specified by:
isTestWhileIdle
in interfaceDruidAbstractDataSourceMBean
-
setTestWhileIdle
public void setTestWhileIdle(boolean testWhileIdle) - Specified by:
setTestWhileIdle
in interfaceDruidAbstractDataSourceMBean
-
isDefaultAutoCommit
public boolean isDefaultAutoCommit()- Specified by:
isDefaultAutoCommit
in interfaceDruidAbstractDataSourceMBean
-
setDefaultAutoCommit
public void setDefaultAutoCommit(boolean defaultAutoCommit) -
getDefaultReadOnly
- Specified by:
getDefaultReadOnly
in interfaceDruidAbstractDataSourceMBean
-
setDefaultReadOnly
-
getDefaultTransactionIsolation
- Specified by:
getDefaultTransactionIsolation
in interfaceDruidAbstractDataSourceMBean
-
setDefaultTransactionIsolation
-
getDefaultCatalog
- Specified by:
getDefaultCatalog
in interfaceDruidAbstractDataSourceMBean
-
setDefaultCatalog
-
getPasswordCallback
-
setPasswordCallback
-
setPasswordCallbackClassName
- Throws:
Exception
-
getUserCallback
-
setUserCallback
-
isInitVariants
public boolean isInitVariants() -
setInitVariants
public void setInitVariants(boolean initVariants) -
isInitGlobalVariants
public boolean isInitGlobalVariants() -
setInitGlobalVariants
public void setInitGlobalVariants(boolean initGlobalVariants) -
getQueryTimeout
public int getQueryTimeout()Retrieves the number of seconds the driver will wait for aStatement
object to execute. If the limit is exceeded, aSQLException
is thrown.- Specified by:
getQueryTimeout
in interfaceDruidAbstractDataSourceMBean
- Returns:
- the current query timeout limit in seconds; zero means there is no limit
Statement
- See Also:
-
setQueryTimeout
public void setQueryTimeout(int seconds) Sets the number of seconds the driver will wait for aStatement
object to execute to the given number of seconds. If the limit is exceeded, anSQLException
is thrown. A JDBC driver must apply this limit to theexecute
,executeQuery
andexecuteUpdate
methods. JDBC driver implementations may also apply this limit toResultSet
methods (consult your driver vendor documentation for details).- Parameters:
seconds
- the new query timeout limit in seconds; zero means there is no limit- See Also:
-
getConnectTimeout
public int getConnectTimeout()- Since:
- 1.2.12
-
setConnectTimeout
public void setConnectTimeout(int milliSeconds) - Since:
- 1.2.12
-
setConnectTimeout
-
getSocketTimeout
public int getSocketTimeout()- Since:
- 1.2.12
-
setSocketTimeout
public void setSocketTimeout(int milliSeconds) - Since:
- 1.2.12
-
setSocketTimeout
-
getName
- Specified by:
getName
in interfaceDataSourceProxy
- Specified by:
getName
in interfaceDruidAbstractDataSourceMBean
-
setName
-
isPoolPreparedStatements
public boolean isPoolPreparedStatements()- Specified by:
isPoolPreparedStatements
in interfaceDruidAbstractDataSourceMBean
-
setPoolPreparedStatements
public abstract void setPoolPreparedStatements(boolean value) -
getMaxWait
public long getMaxWait()- Specified by:
getMaxWait
in interfaceDruidAbstractDataSourceMBean
-
setMaxWait
public void setMaxWait(long maxWaitMillis) -
getNotFullTimeoutRetryCount
public int getNotFullTimeoutRetryCount() -
setNotFullTimeoutRetryCount
public void setNotFullTimeoutRetryCount(int notFullTimeoutRetryCount) -
getMinIdle
public int getMinIdle()- Specified by:
getMinIdle
in interfaceDruidAbstractDataSourceMBean
-
setMinIdle
public void setMinIdle(int value) -
getMaxIdle
public int getMaxIdle()- Specified by:
getMaxIdle
in interfaceDruidAbstractDataSourceMBean
-
setMaxIdle
Deprecated. -
getInitialSize
public int getInitialSize()- Specified by:
getInitialSize
in interfaceDruidAbstractDataSourceMBean
-
setInitialSize
public void setInitialSize(int initialSize) -
getCreateErrorCount
public long getCreateErrorCount()- Specified by:
getCreateErrorCount
in interfaceDruidAbstractDataSourceMBean
-
getMaxActive
public int getMaxActive()- Specified by:
getMaxActive
in interfaceDruidAbstractDataSourceMBean
-
setMaxActive
public abstract void setMaxActive(int maxActive) - Specified by:
setMaxActive
in interfaceDruidAbstractDataSourceMBean
-
getUsername
- Specified by:
getUsername
in interfaceDruidAbstractDataSourceMBean
-
setUsername
-
getPassword
-
setPassword
-
getConnectProperties
- Specified by:
getConnectProperties
in interfaceDataSourceProxy
-
setConnectProperties
-
setConnectionProperties
-
getUrl
- Specified by:
getUrl
in interfaceDataSourceProxy
- Specified by:
getUrl
in interfaceDruidAbstractDataSourceMBean
-
getRawJdbcUrl
- Specified by:
getRawJdbcUrl
in interfaceDataSourceProxy
-
setUrl
-
getDriverClassName
- Specified by:
getDriverClassName
in interfaceDruidAbstractDataSourceMBean
-
setDriverClassName
-
getDriverClassLoader
-
setDriverClassLoader
-
getLogWriter
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
-
setLogWriter
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) - Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
-
getLoginTimeout
public int getLoginTimeout()- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
- Specified by:
getLoginTimeout
in interfaceDruidAbstractDataSourceMBean
-
getDriver
-
setDriver
-
getDriverMajorVersion
public int getDriverMajorVersion()- Specified by:
getDriverMajorVersion
in interfaceDruidAbstractDataSourceMBean
-
getDriverMinorVersion
public int getDriverMinorVersion()- Specified by:
getDriverMinorVersion
in interfaceDruidAbstractDataSourceMBean
-
getExceptionSorter
-
getExceptionSorterClassName
- Specified by:
getExceptionSorterClassName
in interfaceDruidAbstractDataSourceMBean
-
setExceptionSorter
-
setExceptionSorterClassName
- Throws:
Exception
-
setExceptionSorter
- Throws:
SQLException
-
getProxyFilters
- Specified by:
getProxyFilters
in interfaceDataSourceProxy
-
setProxyFilters
-
getFilterClasses
-
setFilters
- Throws:
SQLException
-
addFilters
- Throws:
SQLException
-
clearFilters
public void clearFilters() -
validateConnection
- Throws:
SQLException
-
testConnectionInternal
Deprecated. -
testConnectionInternal
-
getActiveConnections
-
getActiveConnectionStackTrace
- Specified by:
getActiveConnectionStackTrace
in interfaceDruidAbstractDataSourceMBean
-
getCreateTimespanNano
public long getCreateTimespanNano() -
getCreateTimespanMillis
public long getCreateTimespanMillis()- Specified by:
getCreateTimespanMillis
in interfaceDruidAbstractDataSourceMBean
-
getRawDriver
- Specified by:
getRawDriver
in interfaceDataSourceProxy
-
isClearFiltersEnable
public boolean isClearFiltersEnable() -
setClearFiltersEnable
public void setClearFiltersEnable(boolean clearFiltersEnable) -
createConnectionId
public long createConnectionId()- Specified by:
createConnectionId
in interfaceDataSourceProxy
-
createStatementId
public long createStatementId()- Specified by:
createStatementId
in interfaceDataSourceProxy
-
createMetaDataId
public long createMetaDataId()- Specified by:
createMetaDataId
in interfaceDataSourceProxy
-
createResultSetId
public long createResultSetId()- Specified by:
createResultSetId
in interfaceDataSourceProxy
-
createTransactionId
public long createTransactionId()- Specified by:
createTransactionId
in interfaceDataSourceProxy
-
handleConnectionException
- Throws:
SQLException
-
handleConnectionException
public abstract void handleConnectionException(DruidPooledConnection conn, Throwable t, String sql) throws SQLException - Throws:
SQLException
-
recycle
- Throws:
SQLException
-
createPhysicalConnection
- Throws:
SQLException
-
createPhysicalConnection
public DruidAbstractDataSource.PhysicalConnectionInfo createPhysicalConnection() throws SQLException- Throws:
SQLException
-
setCreateError
-
isFailContinuous
public boolean isFailContinuous() -
setFailContinuous
protected void setFailContinuous(boolean fail) -
initPhysicalConnection
- Throws:
SQLException
-
initPhysicalConnection
public void initPhysicalConnection(Connection conn, Map<String, Object> variables, Map<String, throws SQLExceptionObject> globalVariables) - Throws:
SQLException
-
getActivePeak
public abstract int getActivePeak() -
getCompositeData
- Throws:
JMException
-
getID
public long getID() -
getDataSourceId
public long getDataSourceId()- Specified by:
getDataSourceId
in interfaceDataSourceProxy
-
getCreatedTime
- Specified by:
getCreatedTime
in interfaceDruidAbstractDataSourceMBean
-
getRawDriverMajorVersion
public abstract int getRawDriverMajorVersion()- Specified by:
getRawDriverMajorVersion
in interfaceDruidAbstractDataSourceMBean
-
getRawDriverMinorVersion
public abstract int getRawDriverMinorVersion()- Specified by:
getRawDriverMinorVersion
in interfaceDruidAbstractDataSourceMBean
-
getProperties
- Specified by:
getProperties
in interfaceDruidAbstractDataSourceMBean
-
getParentLogger
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-
closePreapredStatement
-
cloneTo
-
discardConnection
-
discardConnection
-
isAsyncCloseConnectionEnable
public boolean isAsyncCloseConnectionEnable() -
setAsyncCloseConnectionEnable
public void setAsyncCloseConnectionEnable(boolean asyncCloseConnectionEnable) -
getCreateScheduler
-
setCreateScheduler
-
getDestroyScheduler
-
setDestroyScheduler
-
isInited
public boolean isInited() -
getMaxCreateTaskCount
public int getMaxCreateTaskCount() -
setMaxCreateTaskCount
public void setMaxCreateTaskCount(int maxCreateTaskCount) -
isFailFast
public boolean isFailFast() -
setFailFast
public void setFailFast(boolean failFast) -
getOnFatalErrorMaxActive
public int getOnFatalErrorMaxActive() -
setOnFatalErrorMaxActive
public void setOnFatalErrorMaxActive(int onFatalErrorMaxActive) -
isOnFatalError
public boolean isOnFatalError() -
isInitExceptionThrow
public boolean isInitExceptionThrow()- Since:
- 1.1.11
-
setInitExceptionThrow
public void setInitExceptionThrow(boolean initExceptionThrow) - Since:
- 1.1.11
-