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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDruidAbstractDataSource.PhysicalConnectionInfo
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DruidAbstractDataSource(boolean lockFair)Constructs a new DruidAbstractDataSource with a specified lock fairness setting.
-
Method Summary
-
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.stat.DataSourceMonitorable
getInitStackTrace, getPoolingConnectionInfo, resetStat
-
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 Detail
-
DEFAULT_INITIAL_SIZE
public static final int DEFAULT_INITIAL_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_ACTIVE_SIZE
public static final int DEFAULT_MAX_ACTIVE_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_IDLE
public static final int DEFAULT_MAX_IDLE
- See Also:
- Constant Field Values
-
DEFAULT_MIN_IDLE
public static final int DEFAULT_MIN_IDLE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_WAIT
public static final int DEFAULT_MAX_WAIT
- See Also:
- Constant Field Values
-
DEFAULT_VALIDATION_QUERY
public static final String DEFAULT_VALIDATION_QUERY
-
DEFAULT_TEST_ON_BORROW
public static final boolean DEFAULT_TEST_ON_BORROW
- See Also:
- Constant Field Values
-
DEFAULT_TEST_ON_RETURN
public static final boolean DEFAULT_TEST_ON_RETURN
- See Also:
- Constant Field Values
-
DEFAULT_WHILE_IDLE
public static final boolean DEFAULT_WHILE_IDLE
- See Also:
- Constant Field Values
-
DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS
public static final long DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_NUM_TESTS_PER_EVICTION_RUN
public static final int DEFAULT_NUM_TESTS_PER_EVICTION_RUN
- See Also:
- Constant Field Values
-
DEFAULT_TIME_CONNECT_TIMEOUT_MILLIS
public static final int DEFAULT_TIME_CONNECT_TIMEOUT_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_TIME_SOCKET_TIMEOUT_MILLIS
public static final int DEFAULT_TIME_SOCKET_TIMEOUT_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_MAX_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_MAX_EVICTABLE_IDLE_TIME_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_PHY_TIMEOUT_MILLIS
public static final long DEFAULT_PHY_TIMEOUT_MILLIS
- See Also:
- Constant Field Values
-
defaultAutoCommit
protected volatile boolean defaultAutoCommit
-
defaultReadOnly
protected volatile Boolean defaultReadOnly
-
defaultTransactionIsolation
protected volatile Integer defaultTransactionIsolation
-
defaultCatalog
protected volatile String defaultCatalog
-
name
protected String name
-
username
protected volatile String username
-
password
protected volatile String password
-
jdbcUrl
protected volatile String jdbcUrl
-
driverClass
protected volatile String driverClass
-
driverClassLoader
protected volatile ClassLoader driverClassLoader
-
connectProperties
protected volatile Properties connectProperties
-
passwordCallback
protected volatile PasswordCallback passwordCallback
-
userCallback
protected volatile NameCallback 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
protected volatile String 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
-
sharePreparedStatements
protected volatile boolean sharePreparedStatements
-
maxPoolPreparedStatementPerConnectionSize
protected volatile int maxPoolPreparedStatementPerConnectionSize
-
inited
protected volatile boolean inited
-
initExceptionThrow
protected volatile boolean initExceptionThrow
-
logWriter
protected PrintWriter logWriter
-
exceptionSorter
protected volatile ExceptionSorter exceptionSorter
-
driver
protected Driver 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
-
dbTypeName
protected volatile String dbTypeName
-
timeBetweenConnectErrorMillis
protected volatile long timeBetweenConnectErrorMillis
-
validConnectionChecker
protected volatile ValidConnectionChecker validConnectionChecker
-
usePingMethod
protected volatile boolean usePingMethod
-
activeConnections
protected final Map<DruidPooledConnection,Object> activeConnections
-
PRESENT
protected static final Object PRESENT
-
id
protected long id
-
connectionErrorRetryAttempts
protected int connectionErrorRetryAttempts
-
breakAfterAcquireFailure
protected boolean breakAfterAcquireFailure
-
transactionThresholdMillis
protected long transactionThresholdMillis
-
createdTime
protected final Date createdTime
-
initedTime
protected Date 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
-
userPasswordVersion
protected volatile long userPasswordVersion
-
filterChainUpdater
protected static final AtomicReferenceFieldUpdater<DruidAbstractDataSource,FilterChainImpl> filterChainUpdater
-
transactionHistogram
protected final Histogram transactionHistogram
-
executeCount
protected volatile long executeCount
-
executeQueryCount
protected volatile long executeQueryCount
-
executeUpdateCount
protected volatile long executeUpdateCount
-
executeBatchCount
protected volatile long executeBatchCount
-
createError
protected volatile Throwable createError
-
lastError
protected volatile Throwable lastError
-
lastErrorTimeMillis
protected volatile long lastErrorTimeMillis
-
lastCreateError
protected volatile Throwable lastCreateError
-
lastCreateErrorTimeMillis
protected volatile long lastCreateErrorTimeMillis
-
lastCreateStartTimeMillis
protected volatile long lastCreateStartTimeMillis
-
isOracle
protected boolean isOracle
-
isMySql
protected boolean isMySql
-
useOracleImplicitCache
protected boolean useOracleImplicitCache
-
lock
protected ReentrantLock lock
-
notEmpty
protected Condition notEmpty
-
empty
protected Condition empty
-
activeConnectionLock
protected ReentrantLock 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
protected DruidDataSourceStatLogger statLogger
-
asyncCloseConnectionEnable
protected boolean asyncCloseConnectionEnable
-
maxCreateTaskCount
protected int maxCreateTaskCount
-
failFast
protected boolean failFast
-
failContinuous
protected volatile int failContinuous
-
failContinuousTimeMillis
protected volatile long failContinuousTimeMillis
-
destroyScheduler
protected ScheduledExecutorService destroyScheduler
-
createScheduler
protected ScheduledExecutorService createScheduler
-
netTimeoutExecutor
protected Executor 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
protected volatile String lastFatalErrorSql
-
lastFatalError
protected volatile Throwable lastFatalError
-
keepAliveError
protected volatile Throwable 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
-
-
Method Detail
-
createChain
protected FilterChainImpl createChain()
-
recycleFilterChain
protected void recycleFilterChain(FilterChainImpl chain)
-
isUseLocalSessionState
public boolean isUseLocalSessionState()
-
setUseLocalSessionState
public void setUseLocalSessionState(boolean useLocalSessionState)
-
isKeepConnectionUnderlyingTransactionIsolation
public boolean isKeepConnectionUnderlyingTransactionIsolation()
-
setKeepConnectionUnderlyingTransactionIsolation
public void setKeepConnectionUnderlyingTransactionIsolation(boolean keepConnectionUnderlyingTransactionIsolation)
-
getStatLogger
public DruidDataSourceStatLogger getStatLogger()
-
setStatLoggerClassName
public void setStatLoggerClassName(String className)
-
setStatLogger
public void setStatLogger(DruidDataSourceStatLogger statLogger)
-
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
public Throwable getLastCreateError()
-
getLastError
public Throwable getLastError()
-
getLastErrorTimeMillis
public long getLastErrorTimeMillis()
-
getLastErrorTime
public Date getLastErrorTime()
-
getLastCreateErrorTimeMillis
public long getLastCreateErrorTimeMillis()
-
getLastCreateErrorTime
public Date 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
public ObjectName getObjectName()
- Specified by:
getObjectNamein interfaceDataSourceMonitorable
-
setObjectName
public void setObjectName(ObjectName objectName)
-
getTransactionHistogram
public Histogram getTransactionHistogram()
-
incrementCachedPreparedStatementCount
public void incrementCachedPreparedStatementCount()
-
decrementCachedPreparedStatementCount
public void decrementCachedPreparedStatementCount()
-
incrementCachedPreparedStatementDeleteCount
public void incrementCachedPreparedStatementDeleteCount()
-
incrementCachedPreparedStatementMissCount
public void incrementCachedPreparedStatementMissCount()
-
incrementUserPasswordVersion
protected void incrementUserPasswordVersion()
-
getUserPasswordVersion
protected long getUserPasswordVersion()
-
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
public abstract void logTransaction(TransactionInfo info)
-
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
-
isSharePreparedStatements
public boolean isSharePreparedStatements()
- Specified by:
isSharePreparedStatementsin interfaceDruidAbstractDataSourceMBean
-
setSharePreparedStatements
public void setSharePreparedStatements(boolean sharePreparedStatements)
-
incrementDupCloseCount
public void incrementDupCloseCount()
-
getValidConnectionChecker
public ValidConnectionChecker getValidConnectionChecker()
-
setValidConnectionChecker
public void setValidConnectionChecker(ValidConnectionChecker validConnectionChecker)
-
isUsePingMethod
public boolean isUsePingMethod()
-
setUsePingMethod
public void setUsePingMethod(boolean usePingMethod)
-
getValidConnectionCheckerClassName
public String getValidConnectionCheckerClassName()
- Specified by:
getValidConnectionCheckerClassNamein interfaceDruidAbstractDataSourceMBean
-
setValidConnectionCheckerClassName
public void setValidConnectionCheckerClassName(String validConnectionCheckerClass) throws Exception
- Throws:
Exception
-
getDbType
public String getDbType()
- Specified by:
getDbTypein interfaceDataSourceProxy- Specified by:
getDbTypein interfaceDruidAbstractDataSourceMBean
-
setDbType
public void setDbType(DbType dbType)
-
setDbType
public void setDbType(String dbType)
-
getConnectionInitSqls
public Collection<String> getConnectionInitSqls()
-
setConnectionInitSqls
public void setConnectionInitSqls(Collection<? extends Object> connectionInitSqls)
-
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 public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
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
public String getValidationQuery()
- Specified by:
getValidationQueryin interfaceDruidAbstractDataSourceMBean
-
setValidationQuery
public void setValidationQuery(String validationQuery)
-
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
public Boolean getDefaultReadOnly()
- Specified by:
getDefaultReadOnlyin interfaceDruidAbstractDataSourceMBean
-
setDefaultReadOnly
public void setDefaultReadOnly(Boolean defaultReadOnly)
-
getDefaultTransactionIsolation
public Integer getDefaultTransactionIsolation()
- Specified by:
getDefaultTransactionIsolationin interfaceDruidAbstractDataSourceMBean
-
setDefaultTransactionIsolation
public void setDefaultTransactionIsolation(Integer defaultTransactionIsolation)
-
getDefaultCatalog
public String getDefaultCatalog()
- Specified by:
getDefaultCatalogin interfaceDruidAbstractDataSourceMBean
-
setDefaultCatalog
public void setDefaultCatalog(String defaultCatalog)
-
getPasswordCallback
public PasswordCallback getPasswordCallback()
-
setPasswordCallback
public void setPasswordCallback(PasswordCallback passwordCallback)
-
setPasswordCallbackClassName
public void setPasswordCallbackClassName(String passwordCallbackClassName) throws Exception
- Throws:
Exception
-
getUserCallback
public NameCallback getUserCallback()
-
setUserCallback
public void setUserCallback(NameCallback userCallback)
-
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(int)
-
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:
getQueryTimeout()
-
getConnectTimeout
public int getConnectTimeout()
- Since:
- 1.2.12
-
setConnectTimeout
public void setConnectTimeout(int milliSeconds)
- Since:
- 1.2.12
-
setConnectTimeout
protected void setConnectTimeout(String milliSeconds)
-
getSocketTimeout
public int getSocketTimeout()
- Since:
- 1.2.12
-
setSocketTimeout
public void setSocketTimeout(int milliSeconds)
- Since:
- 1.2.12
-
setSocketTimeout
protected void setSocketTimeout(String milliSeconds)
-
getName
public String getName()
- Specified by:
getNamein interfaceDataSourceProxy- Specified by:
getNamein interfaceDruidAbstractDataSourceMBean
-
setName
public void setName(String name)
-
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 public void setMaxIdle(int maxIdle)
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
public String getUsername()
- Specified by:
getUsernamein interfaceDruidAbstractDataSourceMBean
-
setUsername
public void setUsername(String username)
-
getPassword
public String getPassword()
-
setPassword
public void setPassword(String password)
-
getConnectProperties
public Properties getConnectProperties()
- Specified by:
getConnectPropertiesin interfaceDataSourceProxy
-
setConnectProperties
public abstract void setConnectProperties(Properties properties)
-
setConnectionProperties
public void setConnectionProperties(String connectionProperties)
-
getUrl
public String getUrl()
- Specified by:
getUrlin interfaceDataSourceProxy- Specified by:
getUrlin interfaceDruidAbstractDataSourceMBean
-
getRawJdbcUrl
public String getRawJdbcUrl()
- Specified by:
getRawJdbcUrlin interfaceDataSourceProxy
-
setUrl
public void setUrl(String jdbcUrl)
-
getDriverClassName
public String getDriverClassName()
- Specified by:
getDriverClassNamein interfaceDruidAbstractDataSourceMBean
-
setDriverClassName
public void setDriverClassName(String driverClass)
-
getDriverClassLoader
public ClassLoader getDriverClassLoader()
-
setDriverClassLoader
public void setDriverClassLoader(ClassLoader driverClassLoader)
-
getLogWriter
public PrintWriter getLogWriter()
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- 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
public Driver getDriver()
-
setDriver
public void setDriver(Driver driver)
-
getDriverMajorVersion
public int getDriverMajorVersion()
- Specified by:
getDriverMajorVersionin interfaceDruidAbstractDataSourceMBean
-
getDriverMinorVersion
public int getDriverMinorVersion()
- Specified by:
getDriverMinorVersionin interfaceDruidAbstractDataSourceMBean
-
getExceptionSorter
public ExceptionSorter getExceptionSorter()
-
getExceptionSorterClassName
public String getExceptionSorterClassName()
- Specified by:
getExceptionSorterClassNamein interfaceDruidAbstractDataSourceMBean
-
setExceptionSorter
public void setExceptionSorter(ExceptionSorter exceptionSoter)
-
setExceptionSorterClassName
public void setExceptionSorterClassName(String exceptionSorter) throws Exception
- Throws:
Exception
-
setExceptionSorter
public void setExceptionSorter(String exceptionSorter) throws SQLException
- Throws:
SQLException
-
getProxyFilters
public List<Filter> getProxyFilters()
- Specified by:
getProxyFiltersin interfaceDataSourceProxy
-
getFilterClasses
public String[] getFilterClasses()
-
setFilters
public void setFilters(String filters) throws SQLException
- Throws:
SQLException
-
addFilters
public void addFilters(String filters) throws SQLException
- Throws:
SQLException
-
clearFilters
public void clearFilters()
-
validateConnection
public void validateConnection(Connection conn) throws SQLException
- Throws:
SQLException
-
testConnectionInternal
protected boolean testConnectionInternal(Connection conn)
Deprecated.
-
testConnectionInternal
protected boolean testConnectionInternal(DruidConnectionHolder holder, Connection conn)
-
getActiveConnections
public Set<DruidPooledConnection> getActiveConnections()
-
getActiveConnectionStackTrace
public List<String> getActiveConnectionStackTrace()
- Specified by:
getActiveConnectionStackTracein interfaceDruidAbstractDataSourceMBean
-
getCreateTimespanNano
public long getCreateTimespanNano()
-
getCreateTimespanMillis
public long getCreateTimespanMillis()
- Specified by:
getCreateTimespanMillisin interfaceDruidAbstractDataSourceMBean
-
getRawDriver
public Driver 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
public void handleConnectionException(DruidPooledConnection conn, Throwable t) throws SQLException
- Throws:
SQLException
-
handleConnectionException
public abstract void handleConnectionException(DruidPooledConnection conn, Throwable t, String sql) throws SQLException
- Throws:
SQLException
-
recycle
protected abstract void recycle(DruidPooledConnection pooledConnection) throws SQLException
- Throws:
SQLException
-
createPhysicalConnection
public Connection createPhysicalConnection(String url, Properties info) throws SQLException
- Throws:
SQLException
-
createPhysicalConnection
public DruidAbstractDataSource.PhysicalConnectionInfo createPhysicalConnection() throws SQLException
- Throws:
SQLException
-
setCreateError
protected void setCreateError(Throwable ex)
-
isFailContinuous
public boolean isFailContinuous()
-
setFailContinuous
protected void setFailContinuous(boolean fail)
-
initPhysicalConnection
public void initPhysicalConnection(Connection conn) throws SQLException
- Throws:
SQLException
-
initPhysicalConnection
public void initPhysicalConnection(Connection conn, Map<String,Object> variables, Map<String,Object> globalVariables) throws SQLException
- Throws:
SQLException
-
getActivePeak
public abstract int getActivePeak()
-
getCompositeData
public CompositeDataSupport getCompositeData() throws JMException
- Specified by:
getCompositeDatain interfaceDataSourceMonitorable- Throws:
JMException
-
fillStatDataToMap
public static void fillStatDataToMap(JdbcDataSourceStat stat, Map<String,Object> map)
-
getID
public long getID()
-
getDataSourceId
public long getDataSourceId()
- Specified by:
getDataSourceIdin interfaceDataSourceProxy
-
getCreatedTime
public Date getCreatedTime()
- Specified by:
getCreatedTimein interfaceDruidAbstractDataSourceMBean
-
getRawDriverMajorVersion
public abstract int getRawDriverMajorVersion()
- Specified by:
getRawDriverMajorVersionin interfaceDruidAbstractDataSourceMBean
-
getRawDriverMinorVersion
public abstract int getRawDriverMinorVersion()
- Specified by:
getRawDriverMinorVersionin interfaceDruidAbstractDataSourceMBean
-
getProperties
public abstract String getProperties()
- Specified by:
getPropertiesin interfaceDruidAbstractDataSourceMBean
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
closePreapredStatement
public void closePreapredStatement(PreparedStatementHolder stmtHolder)
-
cloneTo
protected void cloneTo(DruidAbstractDataSource to)
-
discardConnection
public abstract boolean discardConnection(Connection realConnection)
- Parameters:
realConnection-- Returns:
- true if new connection has been requested during the execution.
-
discardConnection
public boolean discardConnection(DruidConnectionHolder holder)
-
isAsyncCloseConnectionEnable
public boolean isAsyncCloseConnectionEnable()
-
setAsyncCloseConnectionEnable
public void setAsyncCloseConnectionEnable(boolean asyncCloseConnectionEnable)
-
getCreateScheduler
public ScheduledExecutorService getCreateScheduler()
-
setCreateScheduler
public void setCreateScheduler(ScheduledExecutorService createScheduler)
-
getDestroyScheduler
public ScheduledExecutorService getDestroyScheduler()
-
setDestroyScheduler
public void setDestroyScheduler(ScheduledExecutorService destroyScheduler)
-
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
-
-