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,DataSourceMonitorable,Closeable,Serializable,AutoCloseable,Wrapper,CommonDataSource,DataSource
- Direct Known Subclasses:
DruidDataSource
public abstract class DruidAbstractDataSource
extends WrapperAdapter
implements DruidAbstractDataSourceMBean, DataSource, DataSourceProxy, Serializable, DataSourceMonitorable
- Author:
- wenshao [szujobs@hotmail.com], ljw [ljw2083@alibaba-inc.com]
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected ReentrantLockprotected final Map<DruidPooledConnection,Object> protected booleanprotected booleanprotected longprotected longprotected longprotected longprotected longprotected longprotected intprotected longprotected Propertiesprotected intprotected longprotected final Dateprotected Throwableprotected intprotected ScheduledExecutorServiceprotected longprotected longprotected intprotected Stringstatic final intstatic final intstatic final longstatic final intstatic final intstatic final longstatic final intstatic final intstatic final longstatic final booleanstatic final booleanstatic final longstatic final longstatic final intstatic final intstatic final Stringstatic final booleanprotected booleanprotected Stringprotected Booleanprotected Integerprotected longprotected ScheduledExecutorServiceprotected intprotected Driverprotected Stringprotected ClassLoaderprotected longprotected Conditionprotected longprotected ExceptionSorterprotected longprotected longprotected longprotected longprotected intprotected longprotected booleanprotected intprotected intprotected static final AtomicReferenceFieldUpdater<DruidAbstractDataSource,FilterChainImpl> protected longprotected booleanprotected Dateprotected booleanprotected booleanprotected intprotected booleanprotected booleanprotected booleanprotected Stringprotected longprotected Throwableprotected Throwableprotected longprotected longprotected Throwableprotected longprotected Throwableprotected Stringprotected longprotected ReentrantLockprotected booleanprotected PrintWriterprotected intprotected intprotected longprotected intprotected intprotected intprotected longprotected intprotected longprotected longprotected intprotected Stringprotected booleanprotected Executorprotected Conditionprotected intprotected intprotected booleanprotected intprotected Stringprotected PasswordCallbackprotected longprotected longprotected booleanprotected longprotected static final Objectprotected intprotected booleanprotected longprotected longprotected longprotected booleanprotected intprotected longprotected longprotected DruidDataSourceStatLoggerprotected booleanprotected booleanprotected booleanprotected longprotected longprotected longprotected final Histogramprotected longprotected intprotected longprotected booleanprotected booleanprotected NameCallbackprotected Stringprotected Stringprotected intprotected ValidConnectionChecker -
Constructor Summary
ConstructorsConstructorDescriptionDruidAbstractDataSource(boolean lockFair) Constructs a new DruidAbstractDataSource with a specified lock fairness setting. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectionProperty(String name, String value) voidaddFilters(String filters) voidprotected voidvoidclosePreapredStatement(PreparedStatementHolder stmtHolder) protected FilterChainImpllonglongcreatePhysicalConnection(String url, Properties info) longlonglongvoidbooleanabstract booleandiscardConnection(Connection realConnection) static voidfillStatDataToMap(JdbcDataSourceStat stat, Map<String, Object> map) abstract intlonglonglonglonglonglonglonglongintintlonglonglonglongintintlonglonglonglonglonglongString[]longgetID()intlonglonglongintintintlongintintintlongintlongintgetName()intintintlonglonglongabstract StringintRetrieves the number of seconds the driver will wait for aStatementobject to execute.abstract intabstract intintlonglongintlonglonglonglonglong[]long[]intlonggetUrl()intvoidabstract voidhandleConnectionException(DruidPooledConnection conn, Throwable t, String sql) voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidinitPhysicalConnection(Connection conn, Map<String, Object> variables, Map<String, Object> globalVariables) booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisInited()booleanbooleanbooleanbooleanbooleanbooleanbooleanisOracle()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanabstract voidprotected abstract voidrecycle(DruidPooledConnection pooledConnection) protected voidvoidsetAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed) voidsetAsyncCloseConnectionEnable(boolean asyncCloseConnectionEnable) voidsetBreakAfterAcquireFailure(boolean breakAfterAcquireFailure) voidsetClearFiltersEnable(boolean clearFiltersEnable) voidsetConnectionErrorRetryAttempts(int connectionErrorRetryAttempts) voidsetConnectionInitSqls(Collection<? extends Object> connectionInitSqls) voidsetConnectionProperties(String connectionProperties) abstract voidsetConnectProperties(Properties properties) voidsetConnectTimeout(int milliSeconds) protected voidsetConnectTimeout(String milliSeconds) protected voidvoidsetCreateScheduler(ScheduledExecutorService createScheduler) voidvoidvoidsetDefaultAutoCommit(boolean defaultAutoCommit) voidsetDefaultCatalog(String defaultCatalog) voidsetDefaultReadOnly(Boolean defaultReadOnly) voidsetDefaultTransactionIsolation(Integer defaultTransactionIsolation) voidsetDestroyScheduler(ScheduledExecutorService destroyScheduler) voidvoidsetDriverClassLoader(ClassLoader driverClassLoader) voidsetDriverClassName(String driverClass) voidsetDupCloseLogEnable(boolean dupCloseLogEnable) voidsetExceptionSorter(ExceptionSorter exceptionSoter) voidsetExceptionSorter(String exceptionSorter) voidsetExceptionSorterClassName(String exceptionSorter) protected voidsetFailContinuous(boolean fail) voidsetFailFast(boolean failFast) voidsetFilters(String filters) voidsetInitExceptionThrow(boolean initExceptionThrow) voidsetInitGlobalVariants(boolean initGlobalVariants) voidsetInitialSize(int initialSize) voidsetInitVariants(boolean initVariants) voidsetKeepAliveBetweenTimeMillis(long keepAliveBetweenTimeMillis) voidsetKeepConnectionUnderlyingTransactionIsolation(boolean keepConnectionUnderlyingTransactionIsolation) voidsetLogAbandoned(boolean logAbandoned) voidsetLoginTimeout(int seconds) voidsetLogWriter(PrintWriter out) abstract voidsetMaxActive(int maxActive) voidsetMaxCreateTaskCount(int maxCreateTaskCount) voidsetMaxEvictableIdleTimeMillis(long maxEvictableIdleTimeMillis) voidsetMaxIdle(int maxIdle) Deprecated.voidsetMaxOpenPreparedStatements(int maxOpenPreparedStatements) voidsetMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) voidsetMaxWait(long maxWaitMillis) voidsetMaxWaitThreadCount(int maxWaithThreadCount) voidsetMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) voidsetMinIdle(int value) voidvoidsetNotFullTimeoutRetryCount(int notFullTimeoutRetryCount) voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun) Deprecated.voidsetObjectName(ObjectName objectName) voidsetOnFatalErrorMaxActive(int onFatalErrorMaxActive) voidsetOracle(boolean isOracle) voidsetPassword(String password) voidsetPasswordCallback(PasswordCallback passwordCallback) voidsetPasswordCallbackClassName(String passwordCallbackClassName) voidsetPhyMaxUseCount(long phyMaxUseCount) voidsetPhyTimeoutMillis(long phyTimeoutMillis) abstract voidsetPoolPreparedStatements(boolean value) voidsetProxyFilters(List<Filter> filters) voidsetQueryTimeout(int seconds) Sets the number of seconds the driver will wait for aStatementobject to execute to the given number of seconds.voidsetRemoveAbandoned(boolean removeAbandoned) voidsetRemoveAbandonedTimeout(int removeAbandonedTimeout) voidsetRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis) voidsetSharePreparedStatements(boolean sharePreparedStatements) voidsetSocketTimeout(int milliSeconds) protected voidsetSocketTimeout(String milliSeconds) voidsetStatLogger(DruidDataSourceStatLogger statLogger) voidsetStatLoggerClassName(String className) voidsetTestOnBorrow(boolean testOnBorrow) voidsetTestOnReturn(boolean testOnReturn) voidsetTestWhileIdle(boolean testWhileIdle) voidsetTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis) voidsetTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) voidsetTimeBetweenLogStatsMillis(long timeBetweenLogStatsMillis) voidsetTransactionQueryTimeout(int transactionQueryTimeout) voidsetTransactionThresholdMillis(long transactionThresholdMillis) voidvoidsetUseLocalSessionState(boolean useLocalSessionState) voidsetUseOracleImplicitCache(boolean useOracleImplicitCache) voidsetUsePingMethod(boolean usePingMethod) voidsetUserCallback(NameCallback userCallback) voidsetUsername(String username) voidsetUseUnfairLock(boolean useUnfairLock) voidsetValidationQuery(String validationQuery) voidsetValidationQueryTimeout(int validationQueryTimeout) voidsetValidConnectionChecker(ValidConnectionChecker validConnectionChecker) voidsetValidConnectionCheckerClassName(String validConnectionCheckerClass) protected booleantestConnectionInternal(DruidConnectionHolder holder, Connection conn) protected booleanDeprecated.voidvalidateConnection(Connection conn) Methods inherited from class com.alibaba.druid.pool.WrapperAdapter
isWrapperFor, unwrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilderMethods inherited from interface javax.sql.DataSource
createConnectionBuilder, getConnection, getConnectionMethods inherited from interface com.alibaba.druid.stat.DataSourceMonitorable
getInitStackTrace, getPoolingConnectionInfo, resetStatMethods inherited from interface com.alibaba.druid.proxy.jdbc.DataSourceProxy
getDataSourceStatMethods inherited from interface com.alibaba.druid.pool.DruidAbstractDataSourceMBean
getActiveCount, getCloseCount, getConnectCount, getConnectErrorCount, getCreateCount, getDestroyCount, getFilterClassNames, getPoolingCount, getRecycleCount, getRemoveAbandonedCountMethods 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) Constructs a new DruidAbstractDataSource with a specified lock fairness setting.- Parameters:
lockFair- a boolean value indicating whether the lock should be fair or not
-
-
Method Details
-
createChain
-
recycleFilterChain
-
isUseLocalSessionState
public boolean isUseLocalSessionState() -
setUseLocalSessionState
public void setUseLocalSessionState(boolean useLocalSessionState) -
isKeepConnectionUnderlyingTransactionIsolation
public boolean isKeepConnectionUnderlyingTransactionIsolation() -
setKeepConnectionUnderlyingTransactionIsolation
public void setKeepConnectionUnderlyingTransactionIsolation(boolean keepConnectionUnderlyingTransactionIsolation) -
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:
isUseOracleImplicitCachein interfaceDruidAbstractDataSourceMBean
-
setUseOracleImplicitCache
public void setUseOracleImplicitCache(boolean useOracleImplicitCache) - Specified by:
setUseOracleImplicitCachein interfaceDruidAbstractDataSourceMBean
-
getLastCreateError
-
getLastError
-
getLastErrorTimeMillis
public long getLastErrorTimeMillis() -
getLastErrorTime
-
getLastCreateErrorTimeMillis
public long getLastCreateErrorTimeMillis() -
getLastCreateErrorTime
-
getTransactionQueryTimeout
public int getTransactionQueryTimeout()- Specified by:
getTransactionQueryTimeoutin 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
- Specified by:
getObjectNamein interfaceDataSourceMonitorable
-
setObjectName
-
getTransactionHistogram
-
incrementCachedPreparedStatementCount
public void incrementCachedPreparedStatementCount() -
decrementCachedPreparedStatementCount
public void decrementCachedPreparedStatementCount() -
incrementCachedPreparedStatementDeleteCount
public void incrementCachedPreparedStatementDeleteCount() -
incrementCachedPreparedStatementMissCount
public void incrementCachedPreparedStatementMissCount() -
getCachedPreparedStatementMissCount
public long getCachedPreparedStatementMissCount()- Specified by:
getCachedPreparedStatementMissCountin interfaceDruidAbstractDataSourceMBean
-
getCachedPreparedStatementAccessCount
public long getCachedPreparedStatementAccessCount()- Specified by:
getCachedPreparedStatementAccessCountin interfaceDruidAbstractDataSourceMBean
-
getCachedPreparedStatementDeleteCount
public long getCachedPreparedStatementDeleteCount()- Specified by:
getCachedPreparedStatementDeleteCountin interfaceDruidAbstractDataSourceMBean
-
getCachedPreparedStatementCount
public long getCachedPreparedStatementCount()- Specified by:
getCachedPreparedStatementCountin interfaceDruidAbstractDataSourceMBean
-
incrementClosedPreparedStatementCount
public void incrementClosedPreparedStatementCount() -
getClosedPreparedStatementCount
public long getClosedPreparedStatementCount()- Specified by:
getClosedPreparedStatementCountin interfaceDruidAbstractDataSourceMBean
-
incrementPreparedStatementCount
public void incrementPreparedStatementCount() -
getPreparedStatementCount
public long getPreparedStatementCount()- Specified by:
getPreparedStatementCountin interfaceDruidAbstractDataSourceMBean
-
incrementCachedPreparedStatementHitCount
public void incrementCachedPreparedStatementHitCount() -
getCachedPreparedStatementHitCount
public long getCachedPreparedStatementHitCount()- Specified by:
getCachedPreparedStatementHitCountin interfaceDruidAbstractDataSourceMBean
-
getTransactionThresholdMillis
public long getTransactionThresholdMillis()- Specified by:
getTransactionThresholdMillisin interfaceDruidAbstractDataSourceMBean
-
setTransactionThresholdMillis
public void setTransactionThresholdMillis(long transactionThresholdMillis) - Specified by:
setTransactionThresholdMillisin interfaceDruidAbstractDataSourceMBean
-
logTransaction
-
getTransactionHistogramValues
public long[] getTransactionHistogramValues()- Specified by:
getTransactionHistogramValuesin interfaceDruidAbstractDataSourceMBean
-
getTransactionHistogramRanges
public long[] getTransactionHistogramRanges() -
getCommitCount
public long getCommitCount()- Specified by:
getCommitCountin interfaceDruidAbstractDataSourceMBean
-
incrementCommitCount
public void incrementCommitCount() -
getRollbackCount
public long getRollbackCount()- Specified by:
getRollbackCountin interfaceDruidAbstractDataSourceMBean
-
incrementRollbackCount
public void incrementRollbackCount() -
getStartTransactionCount
public long getStartTransactionCount()- Specified by:
getStartTransactionCountin interfaceDruidAbstractDataSourceMBean
-
incrementStartTransactionCount
public void incrementStartTransactionCount() -
isBreakAfterAcquireFailure
public boolean isBreakAfterAcquireFailure()- Specified by:
isBreakAfterAcquireFailurein interfaceDruidAbstractDataSourceMBean
-
setBreakAfterAcquireFailure
public void setBreakAfterAcquireFailure(boolean breakAfterAcquireFailure) -
getConnectionErrorRetryAttempts
public int getConnectionErrorRetryAttempts()- Specified by:
getConnectionErrorRetryAttemptsin interfaceDruidAbstractDataSourceMBean
-
setConnectionErrorRetryAttempts
public void setConnectionErrorRetryAttempts(int connectionErrorRetryAttempts) -
getDupCloseCount
public long getDupCloseCount()- Specified by:
getDupCloseCountin interfaceDruidAbstractDataSourceMBean
-
getMaxPoolPreparedStatementPerConnectionSize
public int getMaxPoolPreparedStatementPerConnectionSize()- Specified by:
getMaxPoolPreparedStatementPerConnectionSizein interfaceDruidAbstractDataSourceMBean
-
setMaxPoolPreparedStatementPerConnectionSize
public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) - Specified by:
setMaxPoolPreparedStatementPerConnectionSizein interfaceDruidAbstractDataSourceMBean
-
incrementDupCloseCount
public void incrementDupCloseCount() -
getValidConnectionChecker
-
setValidConnectionChecker
-
isUsePingMethod
public boolean isUsePingMethod() -
setUsePingMethod
public void setUsePingMethod(boolean usePingMethod) -
getValidConnectionCheckerClassName
- Specified by:
getValidConnectionCheckerClassNamein interfaceDruidAbstractDataSourceMBean
-
setValidConnectionCheckerClassName
- Throws:
Exception
-
getDbType
- Specified by:
getDbTypein interfaceDataSourceProxy- Specified by:
getDbTypein interfaceDruidAbstractDataSourceMBean
-
setDbType
-
setDbType
-
addConnectionProperty
-
getConnectionInitSqls
-
setConnectionInitSqls
-
getTimeBetweenConnectErrorMillis
public long getTimeBetweenConnectErrorMillis()- Specified by:
getTimeBetweenConnectErrorMillisin interfaceDruidAbstractDataSourceMBean
-
setTimeBetweenConnectErrorMillis
public void setTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis) -
getMaxOpenPreparedStatements
public int getMaxOpenPreparedStatements()- Specified by:
getMaxOpenPreparedStatementsin interfaceDruidAbstractDataSourceMBean
-
setMaxOpenPreparedStatements
public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements) -
isLogAbandoned
public boolean isLogAbandoned()- Specified by:
isLogAbandonedin interfaceDruidAbstractDataSourceMBean
-
setLogAbandoned
public void setLogAbandoned(boolean logAbandoned) - Specified by:
setLogAbandonedin interfaceDruidAbstractDataSourceMBean
-
getRemoveAbandonedTimeout
public int getRemoveAbandonedTimeout() -
setRemoveAbandonedTimeout
public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) -
setRemoveAbandonedTimeoutMillis
public void setRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis) -
getRemoveAbandonedTimeoutMillis
public long getRemoveAbandonedTimeoutMillis()- Specified by:
getRemoveAbandonedTimeoutMillisin interfaceDruidAbstractDataSourceMBean
-
isRemoveAbandoned
public boolean isRemoveAbandoned()- Specified by:
isRemoveAbandonedin interfaceDruidAbstractDataSourceMBean
-
setRemoveAbandoned
public void setRemoveAbandoned(boolean removeAbandoned) -
getMinEvictableIdleTimeMillis
public long getMinEvictableIdleTimeMillis()- Specified by:
getMinEvictableIdleTimeMillisin 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- number of tests per eviction run
-
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()- Specified by:
getTimeBetweenEvictionRunsMillisin interfaceDruidAbstractDataSourceMBean
-
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) -
getMaxWaitThreadCount
public int getMaxWaitThreadCount()- Specified by:
getMaxWaitThreadCountin interfaceDruidAbstractDataSourceMBean
-
setMaxWaitThreadCount
public void setMaxWaitThreadCount(int maxWaithThreadCount) -
getValidationQuery
- Specified by:
getValidationQueryin interfaceDruidAbstractDataSourceMBean
-
setValidationQuery
-
getValidationQueryTimeout
public int getValidationQueryTimeout()- Specified by:
getValidationQueryTimeoutin interfaceDruidAbstractDataSourceMBean
-
setValidationQueryTimeout
public void setValidationQueryTimeout(int validationQueryTimeout) -
isAccessToUnderlyingConnectionAllowed
public boolean isAccessToUnderlyingConnectionAllowed() -
setAccessToUnderlyingConnectionAllowed
public void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed) -
isTestOnBorrow
public boolean isTestOnBorrow()- Specified by:
isTestOnBorrowin interfaceDruidAbstractDataSourceMBean
-
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow) - Specified by:
setTestOnBorrowin interfaceDruidAbstractDataSourceMBean
-
isTestOnReturn
public boolean isTestOnReturn()- Specified by:
isTestOnReturnin interfaceDruidAbstractDataSourceMBean
-
setTestOnReturn
public void setTestOnReturn(boolean testOnReturn) -
isTestWhileIdle
public boolean isTestWhileIdle()- Specified by:
isTestWhileIdlein interfaceDruidAbstractDataSourceMBean
-
setTestWhileIdle
public void setTestWhileIdle(boolean testWhileIdle) - Specified by:
setTestWhileIdlein interfaceDruidAbstractDataSourceMBean
-
isDefaultAutoCommit
public boolean isDefaultAutoCommit()- Specified by:
isDefaultAutoCommitin interfaceDruidAbstractDataSourceMBean
-
setDefaultAutoCommit
public void setDefaultAutoCommit(boolean defaultAutoCommit) -
getDefaultReadOnly
- Specified by:
getDefaultReadOnlyin interfaceDruidAbstractDataSourceMBean
-
setDefaultReadOnly
-
getDefaultTransactionIsolation
- Specified by:
getDefaultTransactionIsolationin interfaceDruidAbstractDataSourceMBean
-
setDefaultTransactionIsolation
-
getDefaultCatalog
- Specified by:
getDefaultCatalogin 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 aStatementobject to execute. If the limit is exceeded, aSQLExceptionis thrown.- Specified by:
getQueryTimeoutin 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 aStatementobject to execute to the given number of seconds. If the limit is exceeded, anSQLExceptionis thrown. A JDBC driver must apply this limit to theexecute,executeQueryandexecuteUpdatemethods. JDBC driver implementations may also apply this limit toResultSetmethods (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:
getNamein interfaceDataSourceProxy- Specified by:
getNamein interfaceDruidAbstractDataSourceMBean
-
setName
-
isPoolPreparedStatements
public boolean isPoolPreparedStatements()- Specified by:
isPoolPreparedStatementsin interfaceDruidAbstractDataSourceMBean
-
setPoolPreparedStatements
public abstract void setPoolPreparedStatements(boolean value) -
getMaxWait
public long getMaxWait()- Specified by:
getMaxWaitin interfaceDruidAbstractDataSourceMBean
-
setMaxWait
public void setMaxWait(long maxWaitMillis) -
getNotFullTimeoutRetryCount
public int getNotFullTimeoutRetryCount() -
setNotFullTimeoutRetryCount
public void setNotFullTimeoutRetryCount(int notFullTimeoutRetryCount) -
getMinIdle
public int getMinIdle()- Specified by:
getMinIdlein interfaceDruidAbstractDataSourceMBean
-
setMinIdle
public void setMinIdle(int value) -
getMaxIdle
public int getMaxIdle()- Specified by:
getMaxIdlein interfaceDruidAbstractDataSourceMBean
-
setMaxIdle
Deprecated. -
getInitialSize
public int getInitialSize()- Specified by:
getInitialSizein interfaceDruidAbstractDataSourceMBean
-
setInitialSize
public void setInitialSize(int initialSize) -
getCreateErrorCount
public long getCreateErrorCount()- Specified by:
getCreateErrorCountin interfaceDruidAbstractDataSourceMBean
-
getMaxActive
public int getMaxActive()- Specified by:
getMaxActivein interfaceDruidAbstractDataSourceMBean
-
setMaxActive
public abstract void setMaxActive(int maxActive) - Specified by:
setMaxActivein interfaceDruidAbstractDataSourceMBean
-
getUsername
- Specified by:
getUsernamein interfaceDruidAbstractDataSourceMBean
-
setUsername
-
getPassword
-
setPassword
-
getConnectProperties
- Specified by:
getConnectPropertiesin interfaceDataSourceProxy
-
setConnectProperties
-
setConnectionProperties
-
getUrl
- Specified by:
getUrlin interfaceDataSourceProxy- Specified by:
getUrlin interfaceDruidAbstractDataSourceMBean
-
getRawJdbcUrl
- Specified by:
getRawJdbcUrlin interfaceDataSourceProxy
-
setUrl
-
getDriverClassName
- Specified by:
getDriverClassNamein interfaceDruidAbstractDataSourceMBean
-
setDriverClassName
-
getDriverClassLoader
-
setDriverClassLoader
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) - Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource
-
getLoginTimeout
public int getLoginTimeout()- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Specified by:
getLoginTimeoutin interfaceDruidAbstractDataSourceMBean
-
getDriver
-
setDriver
-
getDriverMajorVersion
public int getDriverMajorVersion()- Specified by:
getDriverMajorVersionin interfaceDruidAbstractDataSourceMBean
-
getDriverMinorVersion
public int getDriverMinorVersion()- Specified by:
getDriverMinorVersionin interfaceDruidAbstractDataSourceMBean
-
getExceptionSorter
-
getExceptionSorterClassName
- Specified by:
getExceptionSorterClassNamein interfaceDruidAbstractDataSourceMBean
-
setExceptionSorter
-
setExceptionSorterClassName
- Throws:
Exception
-
setExceptionSorter
- Throws:
SQLException
-
getProxyFilters
- Specified by:
getProxyFiltersin interfaceDataSourceProxy
-
setProxyFilters
-
getFilterClasses
-
setFilters
- Throws:
SQLException
-
addFilters
- Throws:
SQLException
-
clearFilters
public void clearFilters() -
validateConnection
- Throws:
SQLException
-
testConnectionInternal
Deprecated. -
testConnectionInternal
-
getActiveConnections
-
getActiveConnectionStackTrace
- Specified by:
getActiveConnectionStackTracein interfaceDruidAbstractDataSourceMBean
-
getCreateTimespanNano
public long getCreateTimespanNano() -
getCreateTimespanMillis
public long getCreateTimespanMillis()- Specified by:
getCreateTimespanMillisin interfaceDruidAbstractDataSourceMBean
-
getRawDriver
- Specified by:
getRawDriverin interfaceDataSourceProxy
-
isClearFiltersEnable
public boolean isClearFiltersEnable() -
setClearFiltersEnable
public void setClearFiltersEnable(boolean clearFiltersEnable) -
createConnectionId
public long createConnectionId()- Specified by:
createConnectionIdin interfaceDataSourceProxy
-
createStatementId
public long createStatementId()- Specified by:
createStatementIdin interfaceDataSourceProxy
-
createMetaDataId
public long createMetaDataId()- Specified by:
createMetaDataIdin interfaceDataSourceProxy
-
createResultSetId
public long createResultSetId()- Specified by:
createResultSetIdin interfaceDataSourceProxy
-
createTransactionId
public long createTransactionId()- Specified by:
createTransactionIdin 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
- Specified by:
getCompositeDatain interfaceDataSourceMonitorable- Throws:
JMException
-
fillStatDataToMap
-
getID
public long getID() -
getDataSourceId
public long getDataSourceId()- Specified by:
getDataSourceIdin interfaceDataSourceProxy
-
getCreatedTime
- Specified by:
getCreatedTimein interfaceDruidAbstractDataSourceMBean
-
getRawDriverMajorVersion
public abstract int getRawDriverMajorVersion()- Specified by:
getRawDriverMajorVersionin interfaceDruidAbstractDataSourceMBean
-
getRawDriverMinorVersion
public abstract int getRawDriverMinorVersion()- Specified by:
getRawDriverMinorVersionin interfaceDruidAbstractDataSourceMBean
-
getProperties
- Specified by:
getPropertiesin interfaceDruidAbstractDataSourceMBean
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
closePreapredStatement
-
cloneTo
-
discardConnection
- Parameters:
realConnection-- Returns:
- true if new connection has been requested during the execution.
-
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
-