com.alibaba.druid.pool
类 DruidDataSource
java.lang.Object
com.alibaba.druid.pool.WrapperAdapter
com.alibaba.druid.pool.DruidAbstractDataSource
com.alibaba.druid.pool.DruidDataSource
- 所有已实现的接口:
- DruidAbstractDataSourceMBean, DruidDataSourceMBean, ManagedDataSource, DataSourceProxy, Closeable, Serializable, Cloneable, Wrapper, Referenceable, CommonDataSource, ConnectionPoolDataSource, DataSource
- 直接已知子类:
- DruidXADataSource
public class DruidDataSource
- extends DruidAbstractDataSource
- implements DruidDataSourceMBean, ManagedDataSource, Referenceable, Closeable, Cloneable, ConnectionPoolDataSource
- 作者:
- ljw, wenshao
- 另请参见:
- 序列化表格
| 从类 com.alibaba.druid.pool.DruidAbstractDataSource 继承的字段 |
DEFAULT_INITIAL_SIZE, DEFAULT_MAX_ACTIVE_SIZE, DEFAULT_MAX_IDLE, DEFAULT_MAX_WAIT, DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_MIN_IDLE, DEFAULT_NUM_TESTS_PER_EVICTION_RUN, DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN, DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS, DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_VALIDATION_QUERY, DEFAULT_WHILE_IDLE |
| 从类 com.alibaba.druid.pool.DruidAbstractDataSource 继承的方法 |
addConnectionProperty, addFilters, clearFilters, closePreapredStatement, createConnectionId, createMetaDataId, createPhysicalConnection, createPhysicalConnection, createResultSetId, createStatementId, createTransactionId, decrementCachedPreparedStatementCount, getActiveConnections, getActiveConnectionStackTrace, getCachedPreparedStatementAccessCount, getCachedPreparedStatementCount, getCachedPreparedStatementDeleteCount, getCachedPreparedStatementHitCount, getCachedPreparedStatementMissCount, getClosedPreparedStatementCount, getCommitCount, getCompositeData, getConnectionErrorRetryAttempts, getConnectionInitSqls, getConnectProperties, getCreatedTime, getCreateErrorCount, getCreateTimespanMillis, getCreateTimespanNano, getDbType, getDefaultCatalog, getDefaultReadOnly, getDefaultTransactionIsolation, getDriver, getDriverClassLoader, getDriverClassName, getDriverMajorVersion, getDriverMinorVersion, getDupCloseCount, getExceptionSorter, getExceptionSorterClassName, getExecuteCount, getFilterClasses, getID, getInitialSize, getLastCreateError, getLastCreateErrorTime, getLastCreateErrorTimeMillis, getLastError, getLastErrorTime, getLastErrorTimeMillis, getLoginTimeout, getLogWriter, getMaxActive, getMaxIdle, getMaxOpenPreparedStatements, getMaxPoolPreparedStatementPerConnectionSize, getMaxWait, getMaxWaitThreadCount, getMinEvictableIdleTimeMillis, getMinIdle, getName, getNotFullTimeoutRetryCount, getNumTestsPerEvictionRun, getObjectName, getParentLogger, getPassword, getPasswordCallback, getPreparedStatementCount, getProxyFilters, getQueryTimeout, getRawDriver, getRawJdbcUrl, getRemoveAbandonedTimeout, getRemoveAbandonedTimeoutMillis, getRollbackCount, getStartTransactionCount, getStatLogger, getTimeBetweenConnectErrorMillis, getTimeBetweenEvictionRunsMillis, getTimeBetweenLogStatsMillis, getTransactionHistogram, getTransactionHistogramRanges, getTransactionHistogramValues, getTransactionQueryTimeout, getTransactionThresholdMillis, getUrl, getUserCallback, getUsername, getValidationQuery, getValidationQueryTimeout, getValidConnectionChecker, getValidConnectionCheckerClassName, incrementCachedPreparedStatementCount, incrementCachedPreparedStatementDeleteCount, incrementCachedPreparedStatementHitCount, incrementCachedPreparedStatementMissCount, incrementClosedPreparedStatementCount, incrementCommitCount, incrementDupCloseCount, incrementExecuteCount, incrementPreparedStatementCount, incrementRollbackCount, incrementStartTransactionCount, initPhysicalConnection, isAccessToUnderlyingConnectionAllowed, isBreakAfterAcquireFailure, isClearFiltersEnable, isDefaultAutoCommit, isDupCloseLogEnable, isLogAbandoned, isOracle, isPoolPreparedStatements, isRemoveAbandoned, isSharePreparedStatements, isTestOnBorrow, isTestOnReturn, isTestWhileIdle, isUseLocalSessionState, isUseOracleImplicitCache, isUseUnfairLock, setAccessToUnderlyingConnectionAllowed, setBreakAfterAcquireFailure, setClearFiltersEnable, setConnectionErrorRetryAttempts, setConnectionInitSqls, setConnectionProperties, setDbType, setDefaultAutoCommit, setDefaultCatalog, setDefaultReadOnly, setDefaultTransactionIsolation, setDriver, setDriverClassLoader, setDriverClassName, setDupCloseLogEnable, setExceptionSorter, setExceptionSorter, setExceptionSorterClassName, setFilters, setInitialSize, setLogAbandoned, setLoginTimeout, setLogWriter, setMaxIdle, setMaxOpenPreparedStatements, setMaxPoolPreparedStatementPerConnectionSize, setMaxWait, setMaxWaitThreadCount, setMinEvictableIdleTimeMillis, setMinIdle, setName, setNotFullTimeoutRetryCount, setNumTestsPerEvictionRun, setObjectName, setOracle, setPassword, setPasswordCallback, setPasswordCallbackClassName, setProxyFilters, setQueryTimeout, setRemoveAbandoned, setRemoveAbandonedTimeout, setRemoveAbandonedTimeoutMillis, setSharePreparedStatements, setStatLogger, setStatLoggerClassName, setTestOnBorrow, setTestOnReturn, setTestWhileIdle, setTimeBetweenConnectErrorMillis, setTimeBetweenEvictionRunsMillis, setTimeBetweenLogStatsMillis, setTransactionQueryTimeout, setTransactionThresholdMillis, setUrl, setUseLocalSessionState, setUseOracleImplicitCache, setUserCallback, setUsername, setUseUnfairLock, setValidationQuery, setValidationQueryTimeout, setValidConnectionChecker, setValidConnectionCheckerClassName, validateConnection |
| 从接口 com.alibaba.druid.pool.DruidAbstractDataSourceMBean 继承的方法 |
getActiveConnectionStackTrace, getCachedPreparedStatementAccessCount, getCachedPreparedStatementCount, getCachedPreparedStatementDeleteCount, getCachedPreparedStatementHitCount, getCachedPreparedStatementMissCount, getClosedPreparedStatementCount, getCommitCount, getConnectionErrorRetryAttempts, getCreatedTime, getCreateErrorCount, getCreateTimespanMillis, getDbType, getDefaultCatalog, getDefaultReadOnly, getDefaultTransactionIsolation, getDriverClassName, getDriverMajorVersion, getDriverMinorVersion, getDupCloseCount, getExceptionSorterClassName, getInitialSize, getLoginTimeout, getMaxActive, getMaxIdle, getMaxOpenPreparedStatements, getMaxPoolPreparedStatementPerConnectionSize, getMaxWait, getMaxWaitThreadCount, getMinEvictableIdleTimeMillis, getMinIdle, getName, getPreparedStatementCount, getQueryTimeout, getRemoveAbandonedTimeoutMillis, getRollbackCount, getStartTransactionCount, getTimeBetweenConnectErrorMillis, getTimeBetweenEvictionRunsMillis, getTransactionHistogramValues, getTransactionQueryTimeout, getTransactionThresholdMillis, getUrl, getUsername, getValidationQuery, getValidationQueryTimeout, getValidConnectionCheckerClassName, isBreakAfterAcquireFailure, isDefaultAutoCommit, isLogAbandoned, isPoolPreparedStatements, isRemoveAbandoned, isSharePreparedStatements, isTestOnBorrow, isTestOnReturn, isTestWhileIdle, isUseOracleImplicitCache, setLogAbandoned, setMaxPoolPreparedStatementPerConnectionSize, setTestOnBorrow, setTestWhileIdle, setTransactionThresholdMillis, setUseOracleImplicitCache |
waitNanosLocal
public static ThreadLocal<Long> waitNanosLocal
DruidDataSource
public DruidDataSource()
DruidDataSource
public DruidDataSource(boolean fairLock)
configFromPropety
public void configFromPropety(Properties properties)
isUseGlobalDataSourceStat
public boolean isUseGlobalDataSourceStat()
setUseGlobalDataSourceStat
public void setUseGlobalDataSourceStat(boolean useGlobalDataSourceStat)
getInitStackTrace
public String getInitStackTrace()
isResetStatEnable
public boolean isResetStatEnable()
- 指定者:
- 接口
DruidDataSourceMBean 中的 isResetStatEnable
setResetStatEnable
public void setResetStatEnable(boolean resetStatEnable)
- 指定者:
- 接口
DruidDataSourceMBean 中的 setResetStatEnable
getDiscardCount
public long getDiscardCount()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getDiscardCount
restart
public void restart()
resetStat
public void resetStat()
- 指定者:
- 接口
DruidDataSourceMBean 中的 resetStat
getResetCount
public long getResetCount()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getResetCount
isEnable
public boolean isEnable()
- 指定者:
- 接口
DruidDataSourceMBean 中的 isEnable - 指定者:
- 接口
ManagedDataSource 中的 isEnable
setEnable
public void setEnable(boolean enable)
- 指定者:
- 接口
ManagedDataSource 中的 setEnable
setPoolPreparedStatements
public void setPoolPreparedStatements(boolean value)
- 指定者:
- 接口
DruidDataSourceMBean 中的 setPoolPreparedStatements - 指定者:
- 类
DruidAbstractDataSource 中的 setPoolPreparedStatements
setMaxActive
public void setMaxActive(int maxActive)
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 setMaxActive - 指定者:
- 类
DruidAbstractDataSource 中的 setMaxActive
setConnectProperties
public void setConnectProperties(Properties properties)
- 指定者:
- 类
DruidAbstractDataSource 中的 setConnectProperties
isInited
public boolean isInited()
init
public void init()
throws SQLException
- 抛出:
SQLException
getConnection
public DruidPooledConnection getConnection()
throws SQLException
- 指定者:
- 接口
DataSource 中的 getConnection
- 抛出:
SQLException
getConnection
public DruidPooledConnection getConnection(long maxWaitMillis)
throws SQLException
- 抛出:
SQLException
getPooledConnection
public PooledConnection getPooledConnection()
throws SQLException
- 指定者:
- 接口
ConnectionPoolDataSource 中的 getPooledConnection
- 抛出:
SQLException
getPooledConnection
public PooledConnection getPooledConnection(String user,
String password)
throws SQLException
- 指定者:
- 接口
ConnectionPoolDataSource 中的 getPooledConnection
- 抛出:
SQLException
getConnectionDirect
public DruidPooledConnection getConnectionDirect(long maxWaitMillis)
throws SQLException
- 抛出:
SQLException
discardConnection
public void discardConnection(Connection realConnection)
- 抛弃连接,不进行回收,而是抛弃
- 指定者:
- 类
DruidAbstractDataSource 中的 discardConnection
- 参数:
realConnection -
- 抛出:
SQLException
handleConnectionException
public void handleConnectionException(DruidPooledConnection pooledConnection,
Throwable t)
throws SQLException
- 指定者:
- 类
DruidAbstractDataSource 中的 handleConnectionException
- 抛出:
SQLException
getRecycleErrorCount
public long getRecycleErrorCount()
clearStatementCache
public void clearStatementCache()
throws SQLException
- 指定者:
- 接口
DruidDataSourceMBean 中的 clearStatementCache
- 抛出:
SQLException
close
public void close()
- close datasource
- 指定者:
- 接口
Closeable 中的 close
registerMbean
public void registerMbean()
unregisterMbean
public void unregisterMbean()
isMbeanRegistered
public boolean isMbeanRegistered()
getConnection
public Connection getConnection(String username,
String password)
throws SQLException
- 指定者:
- 接口
DataSource 中的 getConnection
- 抛出:
SQLException
getCreateCount
public long getCreateCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getCreateCount
getDestroyCount
public long getDestroyCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getDestroyCount
getConnectCount
public long getConnectCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getConnectCount
getCloseCount
public long getCloseCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getCloseCount
getConnectErrorCount
public long getConnectErrorCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getConnectErrorCount
getPoolingCount
public int getPoolingCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getPoolingCount
getPoolingPeak
public int getPoolingPeak()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getPoolingPeak
getPoolingPeakTime
public Date getPoolingPeakTime()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getPoolingPeakTime
getRecycleCount
public long getRecycleCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getRecycleCount
getActiveCount
public int getActiveCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getActiveCount
logStats
public void logStats()
getStatValueAndReset
public DruidDataSourceStatValue getStatValueAndReset()
getRemoveAbandonedCount
public long getRemoveAbandonedCount()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getRemoveAbandonedCount
removeAbandoned
public int removeAbandoned()
- 指定者:
- 接口
DruidDataSourceMBean 中的 removeAbandoned
getReference
public Reference getReference()
throws NamingException
- 指定者:
- 接口
Referenceable 中的 getReference
- 抛出:
NamingException
getFilterClassNames
public List<String> getFilterClassNames()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getFilterClassNames
getRawDriverMajorVersion
public int getRawDriverMajorVersion()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getRawDriverMajorVersion - 指定者:
- 类
DruidAbstractDataSource 中的 getRawDriverMajorVersion
getRawDriverMinorVersion
public int getRawDriverMinorVersion()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getRawDriverMinorVersion - 指定者:
- 类
DruidAbstractDataSource 中的 getRawDriverMinorVersion
getProperties
public String getProperties()
- 指定者:
- 接口
DruidAbstractDataSourceMBean 中的 getProperties - 指定者:
- 类
DruidAbstractDataSource 中的 getProperties
shrink
public void shrink()
- 指定者:
- 接口
DruidDataSourceMBean 中的 shrink
shrink
public void shrink(boolean checkTime)
getWaitThreadCount
public int getWaitThreadCount()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getWaitThreadCount
getNotEmptyWaitCount
public long getNotEmptyWaitCount()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getNotEmptyWaitCount
getNotEmptyWaitThreadCount
public int getNotEmptyWaitThreadCount()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getNotEmptyWaitThreadCount
getNotEmptyWaitThreadPeak
public int getNotEmptyWaitThreadPeak()
getNotEmptySignalCount
public long getNotEmptySignalCount()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getNotEmptySignalCount
getNotEmptyWaitMillis
public long getNotEmptyWaitMillis()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getNotEmptyWaitMillis
getNotEmptyWaitNanos
public long getNotEmptyWaitNanos()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getNotEmptyWaitNanos
getLockQueueLength
public int getLockQueueLength()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getLockQueueLength
getActivePeak
public int getActivePeak()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getActivePeak - 指定者:
- 类
DruidAbstractDataSource 中的 getActivePeak
getActivePeakTime
public Date getActivePeakTime()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getActivePeakTime
dump
public String dump()
- 指定者:
- 接口
DruidDataSourceMBean 中的 dump
getErrorCount
public long getErrorCount()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getErrorCount
toString
public String toString()
- 覆盖:
- 类
Object 中的 toString
getPoolingConnectionInfo
public List<Map<String,Object>> getPoolingConnectionInfo()
logTransaction
public void logTransaction(TransactionInfo info)
- 指定者:
- 类
DruidAbstractDataSource 中的 logTransaction
getVersion
public String getVersion()
- 指定者:
- 接口
DruidDataSourceMBean 中的 getVersion
getDataSourceStat
public JdbcDataSourceStat getDataSourceStat()
- 指定者:
- 接口
DataSourceProxy 中的 getDataSourceStat
clone
public Object clone()
throws CloneNotSupportedException
- 覆盖:
- 类
Object 中的 clone
- 抛出:
CloneNotSupportedException
cloneDruidDataSource
public DruidDataSource cloneDruidDataSource()
getStatDataForMBean
public Map<String,Object> getStatDataForMBean()
getStatData
public Map<String,Object> getStatData()
getSqlStat
public JdbcSqlStat getSqlStat(int sqlId)
getSqlStat
public JdbcSqlStat getSqlStat(long sqlId)
getSqlStatMap
public Map<String,JdbcSqlStat> getSqlStatMap()
getWallStatMap
public Map<String,Object> getWallStatMap()
getWallStatValue
public WallProviderStatValue getWallStatValue(boolean reset)
getLock
public Lock getLock()
isWrapperFor
public boolean isWrapperFor(Class<?> iface)
- 指定者:
- 接口
Wrapper 中的 isWrapperFor - 覆盖:
- 类
WrapperAdapter 中的 isWrapperFor
unwrap
public <T> T unwrap(Class<T> iface)
- 指定者:
- 接口
Wrapper 中的 unwrap - 覆盖:
- 类
WrapperAdapter 中的 unwrap
isLogDifferentThread
public boolean isLogDifferentThread()
setLogDifferentThread
public void setLogDifferentThread(boolean logDifferentThread)
tryGetConnection
public DruidPooledConnection tryGetConnection()
throws SQLException
- 抛出:
SQLException
fill
public int fill()
throws SQLException
- 指定者:
- 接口
DruidDataSourceMBean 中的 fill
- 抛出:
SQLException
fill
public int fill(int toCount)
throws SQLException
- 指定者:
- 接口
DruidDataSourceMBean 中的 fill
- 抛出:
SQLException
isFull
public boolean isFull()
Copyright © 2013-2014 Alibaba Group. All Rights Reserved.