public abstract class DruidAbstractDataSource extends WrapperAdapter implements DruidAbstractDataSourceMBean, DataSource, DataSourceProxy, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
DruidAbstractDataSource.PhysicalConnectionInfo |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INITIAL_SIZE |
static int |
DEFAULT_MAX_ACTIVE_SIZE |
static long |
DEFAULT_MAX_EVICTABLE_IDLE_TIME_MILLIS |
static int |
DEFAULT_MAX_IDLE |
static int |
DEFAULT_MAX_WAIT |
static long |
DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
The default value for
getMinEvictableIdleTimeMillis() . |
static int |
DEFAULT_MIN_IDLE |
static int |
DEFAULT_NUM_TESTS_PER_EVICTION_RUN |
static long |
DEFAULT_PHY_TIMEOUT_MILLIS |
static boolean |
DEFAULT_TEST_ON_BORROW |
static boolean |
DEFAULT_TEST_ON_RETURN |
static long |
DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS |
static long |
DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS |
static String |
DEFAULT_VALIDATION_QUERY |
static boolean |
DEFAULT_WHILE_IDLE |
Constructor and Description |
---|
DruidAbstractDataSource(boolean lockFair) |
isWrapperFor, unwrap
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getActiveCount, getCloseCount, getConnectCount, getConnectErrorCount, getCreateCount, getDestroyCount, getFilterClassNames, getPoolingCount, getRecycleCount, getRemoveAbandonedCount
getConnection, getConnection
isWrapperFor, unwrap
getDataSourceStat
public static final int DEFAULT_INITIAL_SIZE
public static final int DEFAULT_MAX_ACTIVE_SIZE
public static final int DEFAULT_MAX_IDLE
public static final int DEFAULT_MIN_IDLE
public static final int DEFAULT_MAX_WAIT
public static final String DEFAULT_VALIDATION_QUERY
public static final boolean DEFAULT_TEST_ON_BORROW
public static final boolean DEFAULT_TEST_ON_RETURN
public static final boolean DEFAULT_WHILE_IDLE
public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
public static final long DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS
public static final int DEFAULT_NUM_TESTS_PER_EVICTION_RUN
public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
getMinEvictableIdleTimeMillis()
.public static final long DEFAULT_MAX_EVICTABLE_IDLE_TIME_MILLIS
public static final long DEFAULT_PHY_TIMEOUT_MILLIS
public boolean isUseLocalSessionState()
public void setUseLocalSessionState(boolean useLocalSessionState)
public DruidDataSourceStatLogger getStatLogger()
public void setStatLoggerClassName(String className)
public void setStatLogger(DruidDataSourceStatLogger statLogger)
public long getTimeBetweenLogStatsMillis()
public void setTimeBetweenLogStatsMillis(long timeBetweenLogStatsMillis)
public boolean isOracle()
public void setOracle(boolean isOracle)
public boolean isUseUnfairLock()
public void setUseUnfairLock(boolean useUnfairLock)
public boolean isUseOracleImplicitCache()
isUseOracleImplicitCache
in interface DruidAbstractDataSourceMBean
public void setUseOracleImplicitCache(boolean useOracleImplicitCache)
setUseOracleImplicitCache
in interface DruidAbstractDataSourceMBean
public Throwable getLastCreateError()
public Throwable getLastError()
public long getLastErrorTimeMillis()
public Date getLastErrorTime()
public long getLastCreateErrorTimeMillis()
public Date getLastCreateErrorTime()
public int getTransactionQueryTimeout()
getTransactionQueryTimeout
in interface DruidAbstractDataSourceMBean
public void setTransactionQueryTimeout(int transactionQueryTimeout)
public long getExecuteCount()
public void incrementExecuteCount()
public boolean isDupCloseLogEnable()
public void setDupCloseLogEnable(boolean dupCloseLogEnable)
public ObjectName getObjectName()
public void setObjectName(ObjectName objectName)
public Histogram getTransactionHistogram()
public void incrementCachedPreparedStatementCount()
public void decrementCachedPreparedStatementCount()
public void incrementCachedPreparedStatementDeleteCount()
public void incrementCachedPreparedStatementMissCount()
public long getCachedPreparedStatementMissCount()
getCachedPreparedStatementMissCount
in interface DruidAbstractDataSourceMBean
public long getCachedPreparedStatementAccessCount()
getCachedPreparedStatementAccessCount
in interface DruidAbstractDataSourceMBean
public long getCachedPreparedStatementDeleteCount()
getCachedPreparedStatementDeleteCount
in interface DruidAbstractDataSourceMBean
public long getCachedPreparedStatementCount()
getCachedPreparedStatementCount
in interface DruidAbstractDataSourceMBean
public void incrementClosedPreparedStatementCount()
public long getClosedPreparedStatementCount()
getClosedPreparedStatementCount
in interface DruidAbstractDataSourceMBean
public void incrementPreparedStatementCount()
public long getPreparedStatementCount()
getPreparedStatementCount
in interface DruidAbstractDataSourceMBean
public void incrementCachedPreparedStatementHitCount()
public long getCachedPreparedStatementHitCount()
getCachedPreparedStatementHitCount
in interface DruidAbstractDataSourceMBean
public long getTransactionThresholdMillis()
getTransactionThresholdMillis
in interface DruidAbstractDataSourceMBean
public void setTransactionThresholdMillis(long transactionThresholdMillis)
setTransactionThresholdMillis
in interface DruidAbstractDataSourceMBean
public abstract void logTransaction(TransactionInfo info)
public long[] getTransactionHistogramValues()
getTransactionHistogramValues
in interface DruidAbstractDataSourceMBean
public long[] getTransactionHistogramRanges()
public long getCommitCount()
getCommitCount
in interface DruidAbstractDataSourceMBean
public void incrementCommitCount()
public long getRollbackCount()
getRollbackCount
in interface DruidAbstractDataSourceMBean
public void incrementRollbackCount()
public long getStartTransactionCount()
getStartTransactionCount
in interface DruidAbstractDataSourceMBean
public void incrementStartTransactionCount()
public boolean isBreakAfterAcquireFailure()
isBreakAfterAcquireFailure
in interface DruidAbstractDataSourceMBean
public void setBreakAfterAcquireFailure(boolean breakAfterAcquireFailure)
public int getConnectionErrorRetryAttempts()
getConnectionErrorRetryAttempts
in interface DruidAbstractDataSourceMBean
public void setConnectionErrorRetryAttempts(int connectionErrorRetryAttempts)
public long getDupCloseCount()
getDupCloseCount
in interface DruidAbstractDataSourceMBean
public int getMaxPoolPreparedStatementPerConnectionSize()
getMaxPoolPreparedStatementPerConnectionSize
in interface DruidAbstractDataSourceMBean
public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize)
setMaxPoolPreparedStatementPerConnectionSize
in interface DruidAbstractDataSourceMBean
public boolean isSharePreparedStatements()
isSharePreparedStatements
in interface DruidAbstractDataSourceMBean
public void setSharePreparedStatements(boolean sharePreparedStatements)
public void incrementDupCloseCount()
public ValidConnectionChecker getValidConnectionChecker()
public void setValidConnectionChecker(ValidConnectionChecker validConnectionChecker)
public String getValidConnectionCheckerClassName()
getValidConnectionCheckerClassName
in interface DruidAbstractDataSourceMBean
public void setValidConnectionCheckerClassName(String validConnectionCheckerClass) throws Exception
Exception
public String getDbType()
getDbType
in interface DruidAbstractDataSourceMBean
getDbType
in interface DataSourceProxy
public void setDbType(String dbType)
public Collection<String> getConnectionInitSqls()
public void setConnectionInitSqls(Collection<? extends Object> connectionInitSqls)
public long getTimeBetweenConnectErrorMillis()
getTimeBetweenConnectErrorMillis
in interface DruidAbstractDataSourceMBean
public void setTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis)
public int getMaxOpenPreparedStatements()
getMaxOpenPreparedStatements
in interface DruidAbstractDataSourceMBean
public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements)
public boolean isLogAbandoned()
isLogAbandoned
in interface DruidAbstractDataSourceMBean
public void setLogAbandoned(boolean logAbandoned)
setLogAbandoned
in interface DruidAbstractDataSourceMBean
public int getRemoveAbandonedTimeout()
public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
public void setRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis)
public long getRemoveAbandonedTimeoutMillis()
getRemoveAbandonedTimeoutMillis
in interface DruidAbstractDataSourceMBean
public boolean isRemoveAbandoned()
isRemoveAbandoned
in interface DruidAbstractDataSourceMBean
public void setRemoveAbandoned(boolean removeAbandoned)
public long getMinEvictableIdleTimeMillis()
getMinEvictableIdleTimeMillis
in interface DruidAbstractDataSourceMBean
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
public long getMaxEvictableIdleTimeMillis()
public void setMaxEvictableIdleTimeMillis(long maxEvictableIdleTimeMillis)
public long getPhyTimeoutMillis()
public void setPhyTimeoutMillis(long phyTimeoutMillis)
public int getNumTestsPerEvictionRun()
@Deprecated public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
numTestsPerEvictionRun
- public long getTimeBetweenEvictionRunsMillis()
getTimeBetweenEvictionRunsMillis
in interface DruidAbstractDataSourceMBean
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
public int getMaxWaitThreadCount()
getMaxWaitThreadCount
in interface DruidAbstractDataSourceMBean
public void setMaxWaitThreadCount(int maxWaithThreadCount)
public String getValidationQuery()
getValidationQuery
in interface DruidAbstractDataSourceMBean
public void setValidationQuery(String validationQuery)
public int getValidationQueryTimeout()
getValidationQueryTimeout
in interface DruidAbstractDataSourceMBean
public void setValidationQueryTimeout(int validationQueryTimeout)
public boolean isAccessToUnderlyingConnectionAllowed()
public void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed)
public boolean isTestOnBorrow()
isTestOnBorrow
in interface DruidAbstractDataSourceMBean
public void setTestOnBorrow(boolean testOnBorrow)
setTestOnBorrow
in interface DruidAbstractDataSourceMBean
public boolean isTestOnReturn()
isTestOnReturn
in interface DruidAbstractDataSourceMBean
public void setTestOnReturn(boolean testOnReturn)
public boolean isTestWhileIdle()
isTestWhileIdle
in interface DruidAbstractDataSourceMBean
public void setTestWhileIdle(boolean testWhileIdle)
setTestWhileIdle
in interface DruidAbstractDataSourceMBean
public boolean isDefaultAutoCommit()
isDefaultAutoCommit
in interface DruidAbstractDataSourceMBean
public void setDefaultAutoCommit(boolean defaultAutoCommit)
public Boolean getDefaultReadOnly()
getDefaultReadOnly
in interface DruidAbstractDataSourceMBean
public void setDefaultReadOnly(Boolean defaultReadOnly)
public Integer getDefaultTransactionIsolation()
getDefaultTransactionIsolation
in interface DruidAbstractDataSourceMBean
public void setDefaultTransactionIsolation(Integer defaultTransactionIsolation)
public String getDefaultCatalog()
getDefaultCatalog
in interface DruidAbstractDataSourceMBean
public void setDefaultCatalog(String defaultCatalog)
public PasswordCallback getPasswordCallback()
public void setPasswordCallback(PasswordCallback passwordCallback)
public void setPasswordCallbackClassName(String passwordCallbackClassName) throws Exception
Exception
public NameCallback getUserCallback()
public void setUserCallback(NameCallback userCallback)
public boolean isInitVariants()
public void setInitVariants(boolean initVariants)
public boolean isInitGlobalVariants()
public void setInitGlobalVariants(boolean initGlobalVariants)
public int getQueryTimeout()
Statement
object to execute. If the limit
is exceeded, a SQLException
is thrown.getQueryTimeout
in interface DruidAbstractDataSourceMBean
Statement
setQueryTimeout(int)
public void setQueryTimeout(int seconds)
Statement
object to execute to the given
number of seconds. If the limit is exceeded, an SQLException
is thrown. A JDBC driver must apply
this limit to the execute
, executeQuery
and executeUpdate
methods. JDBC
driver implementations may also apply this limit to ResultSet
methods (consult your driver vendor
documentation for details).seconds
- the new query timeout limit in seconds; zero means there is no limitgetQueryTimeout()
public String getName()
getName
in interface DruidAbstractDataSourceMBean
getName
in interface DataSourceProxy
public void setName(String name)
public boolean isPoolPreparedStatements()
isPoolPreparedStatements
in interface DruidAbstractDataSourceMBean
public abstract void setPoolPreparedStatements(boolean value)
public long getMaxWait()
getMaxWait
in interface DruidAbstractDataSourceMBean
public void setMaxWait(long maxWaitMillis)
public int getNotFullTimeoutRetryCount()
public void setNotFullTimeoutRetryCount(int notFullTimeoutRetryCount)
public int getMinIdle()
getMinIdle
in interface DruidAbstractDataSourceMBean
public void setMinIdle(int value)
public int getMaxIdle()
getMaxIdle
in interface DruidAbstractDataSourceMBean
@Deprecated public void setMaxIdle(int maxIdle)
public int getInitialSize()
getInitialSize
in interface DruidAbstractDataSourceMBean
public void setInitialSize(int initialSize)
public long getCreateErrorCount()
getCreateErrorCount
in interface DruidAbstractDataSourceMBean
public int getMaxActive()
getMaxActive
in interface DruidAbstractDataSourceMBean
public abstract void setMaxActive(int maxActive)
setMaxActive
in interface DruidAbstractDataSourceMBean
public String getUsername()
getUsername
in interface DruidAbstractDataSourceMBean
public void setUsername(String username)
public String getPassword()
public void setPassword(String password)
public Properties getConnectProperties()
getConnectProperties
in interface DataSourceProxy
public abstract void setConnectProperties(Properties properties)
public void setConnectionProperties(String connectionProperties)
public String getUrl()
getUrl
in interface DruidAbstractDataSourceMBean
getUrl
in interface DataSourceProxy
public String getRawJdbcUrl()
getRawJdbcUrl
in interface DataSourceProxy
public void setUrl(String jdbcUrl)
public String getDriverClassName()
getDriverClassName
in interface DruidAbstractDataSourceMBean
public void setDriverClassName(String driverClass)
public ClassLoader getDriverClassLoader()
public void setDriverClassLoader(ClassLoader driverClassLoader)
public PrintWriter getLogWriter()
getLogWriter
in interface CommonDataSource
public void setLogWriter(PrintWriter out) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
public void setLoginTimeout(int seconds)
setLoginTimeout
in interface CommonDataSource
public int getLoginTimeout()
getLoginTimeout
in interface DruidAbstractDataSourceMBean
getLoginTimeout
in interface CommonDataSource
public Driver getDriver()
public void setDriver(Driver driver)
public int getDriverMajorVersion()
getDriverMajorVersion
in interface DruidAbstractDataSourceMBean
public int getDriverMinorVersion()
getDriverMinorVersion
in interface DruidAbstractDataSourceMBean
public ExceptionSorter getExceptionSorter()
public String getExceptionSorterClassName()
getExceptionSorterClassName
in interface DruidAbstractDataSourceMBean
public void setExceptionSorter(ExceptionSorter exceptionSoter)
public void setExceptionSorterClassName(String exceptionSorter) throws Exception
Exception
public void setExceptionSorter(String exceptionSorter) throws SQLException
SQLException
public List<Filter> getProxyFilters()
getProxyFilters
in interface DataSourceProxy
public String[] getFilterClasses()
public void setFilters(String filters) throws SQLException
SQLException
public void addFilters(String filters) throws SQLException
SQLException
public void clearFilters()
public void validateConnection(Connection conn) throws SQLException
SQLException
public Set<DruidPooledConnection> getActiveConnections()
public List<String> getActiveConnectionStackTrace()
getActiveConnectionStackTrace
in interface DruidAbstractDataSourceMBean
public long getCreateTimespanNano()
public long getCreateTimespanMillis()
getCreateTimespanMillis
in interface DruidAbstractDataSourceMBean
public Driver getRawDriver()
getRawDriver
in interface DataSourceProxy
public boolean isClearFiltersEnable()
public void setClearFiltersEnable(boolean clearFiltersEnable)
public long createConnectionId()
createConnectionId
in interface DataSourceProxy
public long createStatementId()
createStatementId
in interface DataSourceProxy
public long createMetaDataId()
createMetaDataId
in interface DataSourceProxy
public long createResultSetId()
createResultSetId
in interface DataSourceProxy
public long createTransactionId()
createTransactionId
in interface DataSourceProxy
public abstract void handleConnectionException(DruidPooledConnection pooledConnection, Throwable t) throws SQLException
SQLException
public Connection createPhysicalConnection(String url, Properties info) throws SQLException
SQLException
public DruidAbstractDataSource.PhysicalConnectionInfo createPhysicalConnection() throws SQLException
SQLException
public void initPhysicalConnection(Connection conn) throws SQLException
SQLException
public void initPhysicalConnection(Connection conn, Map<String,Object> variables, Map<String,Object> globalVariables) throws SQLException
SQLException
public abstract int getActivePeak()
public CompositeDataSupport getCompositeData() throws JMException
JMException
public long getID()
public Date getCreatedTime()
getCreatedTime
in interface DruidAbstractDataSourceMBean
public abstract int getRawDriverMajorVersion()
getRawDriverMajorVersion
in interface DruidAbstractDataSourceMBean
public abstract int getRawDriverMinorVersion()
getRawDriverMinorVersion
in interface DruidAbstractDataSourceMBean
public abstract String getProperties()
getProperties
in interface DruidAbstractDataSourceMBean
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface CommonDataSource
SQLFeatureNotSupportedException
public void closePreapredStatement(PreparedStatementHolder stmtHolder)
public abstract void discardConnection(Connection realConnection)
public boolean isAsyncCloseConnectionEnable()
public void setAsyncCloseConnectionEnable(boolean asyncCloseConnectionEnable)
public ScheduledExecutorService getCreateScheduler()
public void setCreateScheduler(ScheduledExecutorService createScheduler)
public ScheduledExecutorService getDestroyScheduler()
public void setDestroyScheduler(ScheduledExecutorService destroyScheduler)
public boolean isInited()
public int getMaxCreateTaskCount()
public void setMaxCreateTaskCount(int maxCreateTaskCount)
public boolean isFailFast()
public void setFailFast(boolean failFast)
Copyright © 2013–2017 Alibaba Group. All rights reserved.