com.alibaba.druid.pool
Class DruidAbstractDataSource

java.lang.Object
  extended by com.alibaba.druid.pool.WrapperAdapter
      extended by com.alibaba.druid.pool.DruidAbstractDataSource
All Implemented Interfaces:
DruidAbstractDataSourceMBean, DataSourceProxy, Serializable, Wrapper, CommonDataSource, DataSource
Direct Known Subclasses:
DruidDataSource

public abstract class DruidAbstractDataSource
extends WrapperAdapter
implements DruidAbstractDataSourceMBean, DataSource, DataSourceProxy, Serializable

Author:
wenshao, ljw
See Also:
Serialized Form

Field Summary
static int DEFAULT_INITIAL_SIZE
           
static int DEFAULT_MAX_ACTIVE_SIZE
           
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 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 Summary
DruidAbstractDataSource(boolean lockFair)
           
 
Method Summary
 void addConnectionProperty(String name, String value)
           
 void closePreapredStatement(PreparedStatementHolder stmtHolder)
           
 long createConnectionId()
           
 Connection createPhysicalConnection()
           
 Connection createPhysicalConnection(String url, Properties info)
           
 long createResultSetId()
           
 long createStatementId()
           
 long createTransactionId()
           
 void decrementCachedPreparedStatementCount()
           
abstract  void discardConnection(Connection realConnection)
           
 Set<DruidPooledConnection> getActiveConnections()
           
 List<String> getActiveConnectionStackTrace()
           
abstract  int getActivePeak()
           
 long getCachedPreparedStatementAccessCount()
           
 long getCachedPreparedStatementCount()
           
 long getCachedPreparedStatementDeleteCount()
           
 long getCachedPreparedStatementHitCount()
           
 long getCachedPreparedStatementMissCount()
           
 long getClosedPreparedStatementCount()
           
 long getCommitCount()
           
 CompositeDataSupport getCompositeData()
           
 int getConnectionErrorRetryAttempts()
           
 Collection<String> getConnectionInitSqls()
           
 Properties getConnectProperties()
           
 Date getCreatedTime()
           
 long getCreateErrorCount()
           
 long getCreateTimespanMillis()
           
 long getCreateTimespanNano()
           
 String getDbType()
           
 String getDefaultCatalog()
           
 Boolean getDefaultReadOnly()
           
 Integer getDefaultTransactionIsolation()
           
 Driver getDriver()
           
 ClassLoader getDriverClassLoader()
           
 String getDriverClassName()
           
 int getDriverMajorVersion()
           
 int getDriverMinorVersion()
           
 long getDupCloseCount()
           
 ExceptionSorter getExceptionSorter()
           
 String getExceptionSorterClassName()
           
 long getExecuteCount()
           
 String[] getFilterClasses()
           
 long getID()
           
 int getInitialSize()
           
 Throwable getLastCreateError()
           
 Date getLastCreateErrorTime()
           
 long getLastCreateErrorTimeMillis()
           
 Throwable getLastError()
           
 Date getLastErrorTime()
           
 long getLastErrorTimeMillis()
           
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 int getMaxActive()
           
 int getMaxIdle()
           
 int getMaxOpenPreparedStatements()
           
 int getMaxPoolPreparedStatementPerConnectionSize()
           
 long getMaxWait()
           
 int getMaxWaitThreadCount()
           
 long getMinEvictableIdleTimeMillis()
           
 int getMinIdle()
           
 String getName()
           
 int getNumTestsPerEvictionRun()
           
 ObjectName getObjectName()
           
 Logger getParentLogger()
           
 String getPassword()
           
 PasswordCallback getPasswordCallback()
           
 long getPreparedStatementCount()
           
abstract  String getProperties()
           
 List<Filter> getProxyFilters()
           
 int getQueryTimeout()
          Retrieves the number of seconds the driver will wait for a Statement object to execute.
 Driver getRawDriver()
           
abstract  int getRawDriverMajorVersion()
           
abstract  int getRawDriverMinorVersion()
           
 String getRawJdbcUrl()
           
 int getRemoveAbandonedTimeout()
           
 long getRemoveAbandonedTimeoutMillis()
           
 long getRollbackCount()
           
 long getStartTransactionCount()
           
 long getTimeBetweenConnectErrorMillis()
           
 long getTimeBetweenEvictionRunsMillis()
           
 Histogram getTransactionHistogram()
           
 long[] getTransactionHistogramRanges()
           
 long[] getTransactionHistogramValues()
           
 int getTransactionQueryTimeout()
           
 long getTransactionThresholdMillis()
           
 String getUrl()
           
 NameCallback getUserCallback()
           
 String getUsername()
           
 String getValidationQuery()
           
 int getValidationQueryTimeout()
           
 ValidConnectionChecker getValidConnectionChecker()
           
 String getValidConnectionCheckerClassName()
           
abstract  void handleConnectionException(DruidPooledConnection pooledConnection, Throwable t)
           
 void incrementCachedPreparedStatementCount()
           
 void incrementCachedPreparedStatementDeleteCount()
           
 void incrementCachedPreparedStatementHitCount()
           
 void incrementCachedPreparedStatementMissCount()
           
 void incrementClosedPreparedStatementCount()
           
 void incrementCommitCount()
           
 void incrementDupCloseCount()
           
 void incrementExecuteCount()
           
 void incrementPreparedStatementCount()
           
 void incrementRollbackCount()
           
 void incrementStartTransactionCount()
           
 void initPhysicalConnection(Connection conn)
           
 boolean isAccessToUnderlyingConnectionAllowed()
           
 boolean isBreakAfterAcquireFailure()
           
 boolean isDefaultAutoCommit()
           
 boolean isDupCloseLogEnable()
           
 boolean isLogAbandoned()
           
 boolean isOracle()
           
 boolean isPoolPreparedStatements()
           
 boolean isRemoveAbandoned()
           
 boolean isSharePreparedStatements()
           
 boolean isTestOnBorrow()
           
 boolean isTestOnReturn()
           
 boolean isTestWhileIdle()
           
 boolean isUseOracleImplicitCache()
           
 boolean isUseUnfairLock()
           
abstract  void logTransaction(TransactionInfo info)
           
 void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed)
           
 void setBreakAfterAcquireFailure(boolean breakAfterAcquireFailure)
           
 void setConnectionErrorRetryAttempts(int connectionErrorRetryAttempts)
           
 void setConnectionInitSqls(Collection<Object> connectionInitSqls)
           
 void setConnectionProperties(String connectionProperties)
           
abstract  void setConnectProperties(Properties properties)
           
 void setDbType(String dbType)
           
 void setDefaultAutoCommit(boolean defaultAutoCommit)
           
 void setDefaultCatalog(String defaultCatalog)
           
 void setDefaultReadOnly(Boolean defaultReadOnly)
           
 void setDefaultTransactionIsolation(Integer defaultTransactionIsolation)
           
 void setDriver(Driver driver)
           
 void setDriverClassLoader(ClassLoader driverClassLoader)
           
 void setDriverClassName(String driverClass)
           
 void setDupCloseLogEnable(boolean dupCloseLogEnable)
           
 void setExceptionSorter(ExceptionSorter exceptionSoter)
           
 void setExceptionSorter(String exceptionSorter)
           
 void setExceptionSorterClassName(String exceptionSorter)
           
 void setFilters(String filters)
           
 void setInitialSize(int initialSize)
           
 void setLogAbandoned(boolean logAbandoned)
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(PrintWriter out)
           
abstract  void setMaxActive(int maxActive)
           
 void setMaxIdle(int maxIdle)
          Deprecated. 
 void setMaxOpenPreparedStatements(int maxOpenPreparedStatements)
           
 void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize)
           
 void setMaxWait(long maxWaitMillis)
           
 void setMaxWaitThreadCount(int maxWaithThreadCount)
           
 void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
           
 void setMinIdle(int value)
           
 void setName(String name)
           
 void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
          Deprecated. 
 void setObjectName(ObjectName objectName)
           
 void setOracle(boolean isOracle)
           
 void setPassword(String password)
           
 void setPasswordCallback(PasswordCallback passwordCallback)
           
 void setPasswordCallbackClassName(String passwordCallbackClassName)
           
abstract  void setPoolPreparedStatements(boolean value)
           
 void setProxyFilters(List<Filter> filters)
           
 void setQueryTimeout(int seconds)
          Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.
 void setRemoveAbandoned(boolean removeAbandoned)
           
 void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
           
 void setRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis)
           
 void setSharePreparedStatements(boolean sharePreparedStatements)
           
 void setTestOnBorrow(boolean testOnBorrow)
           
 void setTestOnReturn(boolean testOnReturn)
           
 void setTestWhileIdle(boolean testWhileIdle)
           
 void setTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis)
           
 void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
           
 void setTransactionQueryTimeout(int transactionQueryTimeout)
           
 void setTransactionThresholdMillis(long transactionThresholdMillis)
           
 void setUrl(String jdbcUrl)
           
 void setUseOracleImplicitCache(boolean useOracleImplicitCache)
           
 void setUserCallback(NameCallback userCallback)
           
 void setUsername(String username)
           
 void setUseUnfairLock(boolean useUnfairLock)
           
 void setValidationQuery(String validationQuery)
           
 void setValidationQueryTimeout(int validationQueryTimeout)
           
 void setValidConnectionChecker(ValidConnectionChecker validConnectionChecker)
           
 void setValidConnectionCheckerClassName(String validConnectionCheckerClass)
           
 void validateConnection(Connection conn)
           
 
Methods inherited from class com.alibaba.druid.pool.WrapperAdapter
isWrapperFor, unwrap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.alibaba.druid.pool.DruidAbstractDataSourceMBean
getActiveCount, getCloseCount, getConnectCount, getConnectErrorCount, getCreateCount, getDestroyCount, getFilterClassNames, getPoolingCount, getRecycleCount, getRemoveAbandonedCount
 
Methods inherited from interface javax.sql.DataSource
getConnection, getConnection
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 
Methods inherited from interface com.alibaba.druid.proxy.jdbc.DataSourceProxy
getDataSourceStat
 

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_MIN_EVICTABLE_IDLE_TIME_MILLIS

public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
The default value for getMinEvictableIdleTimeMillis().

See Also:
getMinEvictableIdleTimeMillis(), setMinEvictableIdleTimeMillis(long), Constant Field Values
Constructor Detail

DruidAbstractDataSource

public DruidAbstractDataSource(boolean lockFair)
Method Detail

isOracle

public boolean isOracle()

setOracle

public void setOracle(boolean isOracle)

isUseUnfairLock

public boolean isUseUnfairLock()

setUseUnfairLock

public void setUseUnfairLock(boolean useUnfairLock)

isUseOracleImplicitCache

public boolean isUseOracleImplicitCache()
Specified by:
isUseOracleImplicitCache in interface DruidAbstractDataSourceMBean

setUseOracleImplicitCache

public void setUseOracleImplicitCache(boolean useOracleImplicitCache)
Specified by:
setUseOracleImplicitCache in interface DruidAbstractDataSourceMBean

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:
getTransactionQueryTimeout in interface DruidAbstractDataSourceMBean

setTransactionQueryTimeout

public void setTransactionQueryTimeout(int transactionQueryTimeout)

getExecuteCount

public long getExecuteCount()

incrementExecuteCount

public void incrementExecuteCount()

isDupCloseLogEnable

public boolean isDupCloseLogEnable()

setDupCloseLogEnable

public void setDupCloseLogEnable(boolean dupCloseLogEnable)

getObjectName

public ObjectName getObjectName()

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()

getCachedPreparedStatementMissCount

public long getCachedPreparedStatementMissCount()
Specified by:
getCachedPreparedStatementMissCount in interface DruidAbstractDataSourceMBean

getCachedPreparedStatementAccessCount

public long getCachedPreparedStatementAccessCount()
Specified by:
getCachedPreparedStatementAccessCount in interface DruidAbstractDataSourceMBean

getCachedPreparedStatementDeleteCount

public long getCachedPreparedStatementDeleteCount()
Specified by:
getCachedPreparedStatementDeleteCount in interface DruidAbstractDataSourceMBean

getCachedPreparedStatementCount

public long getCachedPreparedStatementCount()
Specified by:
getCachedPreparedStatementCount in interface DruidAbstractDataSourceMBean

incrementClosedPreparedStatementCount

public void incrementClosedPreparedStatementCount()

getClosedPreparedStatementCount

public long getClosedPreparedStatementCount()
Specified by:
getClosedPreparedStatementCount in interface DruidAbstractDataSourceMBean

incrementPreparedStatementCount

public void incrementPreparedStatementCount()

getPreparedStatementCount

public long getPreparedStatementCount()
Specified by:
getPreparedStatementCount in interface DruidAbstractDataSourceMBean

incrementCachedPreparedStatementHitCount

public void incrementCachedPreparedStatementHitCount()

getCachedPreparedStatementHitCount

public long getCachedPreparedStatementHitCount()
Specified by:
getCachedPreparedStatementHitCount in interface DruidAbstractDataSourceMBean

getTransactionThresholdMillis

public long getTransactionThresholdMillis()
Specified by:
getTransactionThresholdMillis in interface DruidAbstractDataSourceMBean

setTransactionThresholdMillis

public void setTransactionThresholdMillis(long transactionThresholdMillis)
Specified by:
setTransactionThresholdMillis in interface DruidAbstractDataSourceMBean

logTransaction

public abstract void logTransaction(TransactionInfo info)

getTransactionHistogramValues

public long[] getTransactionHistogramValues()
Specified by:
getTransactionHistogramValues in interface DruidAbstractDataSourceMBean

getTransactionHistogramRanges

public long[] getTransactionHistogramRanges()

getCommitCount

public long getCommitCount()
Specified by:
getCommitCount in interface DruidAbstractDataSourceMBean

incrementCommitCount

public void incrementCommitCount()

getRollbackCount

public long getRollbackCount()
Specified by:
getRollbackCount in interface DruidAbstractDataSourceMBean

incrementRollbackCount

public void incrementRollbackCount()

getStartTransactionCount

public long getStartTransactionCount()
Specified by:
getStartTransactionCount in interface DruidAbstractDataSourceMBean

incrementStartTransactionCount

public void incrementStartTransactionCount()

isBreakAfterAcquireFailure

public boolean isBreakAfterAcquireFailure()
Specified by:
isBreakAfterAcquireFailure in interface DruidAbstractDataSourceMBean

setBreakAfterAcquireFailure

public void setBreakAfterAcquireFailure(boolean breakAfterAcquireFailure)

getConnectionErrorRetryAttempts

public int getConnectionErrorRetryAttempts()
Specified by:
getConnectionErrorRetryAttempts in interface DruidAbstractDataSourceMBean

setConnectionErrorRetryAttempts

public void setConnectionErrorRetryAttempts(int connectionErrorRetryAttempts)

getDupCloseCount

public long getDupCloseCount()
Specified by:
getDupCloseCount in interface DruidAbstractDataSourceMBean

getMaxPoolPreparedStatementPerConnectionSize

public int getMaxPoolPreparedStatementPerConnectionSize()
Specified by:
getMaxPoolPreparedStatementPerConnectionSize in interface DruidAbstractDataSourceMBean

setMaxPoolPreparedStatementPerConnectionSize

public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize)
Specified by:
setMaxPoolPreparedStatementPerConnectionSize in interface DruidAbstractDataSourceMBean

isSharePreparedStatements

public boolean isSharePreparedStatements()
Specified by:
isSharePreparedStatements in interface DruidAbstractDataSourceMBean

setSharePreparedStatements

public void setSharePreparedStatements(boolean sharePreparedStatements)

incrementDupCloseCount

public void incrementDupCloseCount()

getValidConnectionChecker

public ValidConnectionChecker getValidConnectionChecker()

setValidConnectionChecker

public void setValidConnectionChecker(ValidConnectionChecker validConnectionChecker)

getValidConnectionCheckerClassName

public String getValidConnectionCheckerClassName()
Specified by:
getValidConnectionCheckerClassName in interface DruidAbstractDataSourceMBean

setValidConnectionCheckerClassName

public void setValidConnectionCheckerClassName(String validConnectionCheckerClass)
                                        throws Exception
Throws:
Exception

getDbType

public String getDbType()
Specified by:
getDbType in interface DruidAbstractDataSourceMBean
Specified by:
getDbType in interface DataSourceProxy

setDbType

public void setDbType(String dbType)

addConnectionProperty

public void addConnectionProperty(String name,
                                  String value)

getConnectionInitSqls

public Collection<String> getConnectionInitSqls()

setConnectionInitSqls

public void setConnectionInitSqls(Collection<Object> connectionInitSqls)

getTimeBetweenConnectErrorMillis

public long getTimeBetweenConnectErrorMillis()
Specified by:
getTimeBetweenConnectErrorMillis in interface DruidAbstractDataSourceMBean

setTimeBetweenConnectErrorMillis

public void setTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis)

getMaxOpenPreparedStatements

public int getMaxOpenPreparedStatements()
Specified by:
getMaxOpenPreparedStatements in interface DruidAbstractDataSourceMBean

setMaxOpenPreparedStatements

public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements)

isLogAbandoned

public boolean isLogAbandoned()
Specified by:
isLogAbandoned in interface DruidAbstractDataSourceMBean

setLogAbandoned

public void setLogAbandoned(boolean logAbandoned)
Specified by:
setLogAbandoned in interface DruidAbstractDataSourceMBean

getRemoveAbandonedTimeout

public int getRemoveAbandonedTimeout()

setRemoveAbandonedTimeout

public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)

setRemoveAbandonedTimeoutMillis

public void setRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis)

getRemoveAbandonedTimeoutMillis

public long getRemoveAbandonedTimeoutMillis()
Specified by:
getRemoveAbandonedTimeoutMillis in interface DruidAbstractDataSourceMBean

isRemoveAbandoned

public boolean isRemoveAbandoned()
Specified by:
isRemoveAbandoned in interface DruidAbstractDataSourceMBean

setRemoveAbandoned

public void setRemoveAbandoned(boolean removeAbandoned)

getMinEvictableIdleTimeMillis

public long getMinEvictableIdleTimeMillis()
Specified by:
getMinEvictableIdleTimeMillis in interface DruidAbstractDataSourceMBean

setMinEvictableIdleTimeMillis

public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)

getNumTestsPerEvictionRun

public int getNumTestsPerEvictionRun()

setNumTestsPerEvictionRun

@Deprecated
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Deprecated. 

Parameters:
numTestsPerEvictionRun -

getTimeBetweenEvictionRunsMillis

public long getTimeBetweenEvictionRunsMillis()
Specified by:
getTimeBetweenEvictionRunsMillis in interface DruidAbstractDataSourceMBean

setTimeBetweenEvictionRunsMillis

public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)

getMaxWaitThreadCount

public int getMaxWaitThreadCount()
Specified by:
getMaxWaitThreadCount in interface DruidAbstractDataSourceMBean

setMaxWaitThreadCount

public void setMaxWaitThreadCount(int maxWaithThreadCount)

getValidationQuery

public String getValidationQuery()
Specified by:
getValidationQuery in interface DruidAbstractDataSourceMBean

setValidationQuery

public void setValidationQuery(String validationQuery)

getValidationQueryTimeout

public int getValidationQueryTimeout()
Specified by:
getValidationQueryTimeout in interface DruidAbstractDataSourceMBean

setValidationQueryTimeout

public void setValidationQueryTimeout(int validationQueryTimeout)

isAccessToUnderlyingConnectionAllowed

public boolean isAccessToUnderlyingConnectionAllowed()

setAccessToUnderlyingConnectionAllowed

public void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed)

isTestOnBorrow

public boolean isTestOnBorrow()
Specified by:
isTestOnBorrow in interface DruidAbstractDataSourceMBean

setTestOnBorrow

public void setTestOnBorrow(boolean testOnBorrow)
Specified by:
setTestOnBorrow in interface DruidAbstractDataSourceMBean

isTestOnReturn

public boolean isTestOnReturn()
Specified by:
isTestOnReturn in interface DruidAbstractDataSourceMBean

setTestOnReturn

public void setTestOnReturn(boolean testOnReturn)

isTestWhileIdle

public boolean isTestWhileIdle()
Specified by:
isTestWhileIdle in interface DruidAbstractDataSourceMBean

setTestWhileIdle

public void setTestWhileIdle(boolean testWhileIdle)
Specified by:
setTestWhileIdle in interface DruidAbstractDataSourceMBean

isDefaultAutoCommit

public boolean isDefaultAutoCommit()
Specified by:
isDefaultAutoCommit in interface DruidAbstractDataSourceMBean

setDefaultAutoCommit

public void setDefaultAutoCommit(boolean defaultAutoCommit)

getDefaultReadOnly

public Boolean getDefaultReadOnly()
Specified by:
getDefaultReadOnly in interface DruidAbstractDataSourceMBean

setDefaultReadOnly

public void setDefaultReadOnly(Boolean defaultReadOnly)

getDefaultTransactionIsolation

public Integer getDefaultTransactionIsolation()
Specified by:
getDefaultTransactionIsolation in interface DruidAbstractDataSourceMBean

setDefaultTransactionIsolation

public void setDefaultTransactionIsolation(Integer defaultTransactionIsolation)

getDefaultCatalog

public String getDefaultCatalog()
Specified by:
getDefaultCatalog in interface DruidAbstractDataSourceMBean

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)

getQueryTimeout

public int getQueryTimeout()
Retrieves the number of seconds the driver will wait for a Statement object to execute. If the limit is exceeded, a SQLException is thrown.

Specified by:
getQueryTimeout in interface DruidAbstractDataSourceMBean
Returns:
the current query timeout limit in seconds; zero means there is no limit
Throws:
SQLException - if a database access error occurs or this method is called on a closed Statement
See Also:
setQueryTimeout(int)

setQueryTimeout

public void setQueryTimeout(int seconds)
Sets the number of seconds the driver will wait for a 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).

Parameters:
seconds - the new query timeout limit in seconds; zero means there is no limit
Throws:
SQLException - if a database access error occurs, this method is called on a closed Statement or the condition seconds >= 0 is not satisfied
See Also:
getQueryTimeout()

getName

public String getName()
Specified by:
getName in interface DruidAbstractDataSourceMBean
Specified by:
getName in interface DataSourceProxy

setName

public void setName(String name)

isPoolPreparedStatements

public boolean isPoolPreparedStatements()
Specified by:
isPoolPreparedStatements in interface DruidAbstractDataSourceMBean

setPoolPreparedStatements

public abstract void setPoolPreparedStatements(boolean value)

getMaxWait

public long getMaxWait()
Specified by:
getMaxWait in interface DruidAbstractDataSourceMBean

setMaxWait

public void setMaxWait(long maxWaitMillis)

getMinIdle

public int getMinIdle()
Specified by:
getMinIdle in interface DruidAbstractDataSourceMBean

setMinIdle

public void setMinIdle(int value)

getMaxIdle

public int getMaxIdle()
Specified by:
getMaxIdle in interface DruidAbstractDataSourceMBean

setMaxIdle

@Deprecated
public void setMaxIdle(int maxIdle)
Deprecated. 


getInitialSize

public int getInitialSize()
Specified by:
getInitialSize in interface DruidAbstractDataSourceMBean

setInitialSize

public void setInitialSize(int initialSize)

getCreateErrorCount

public long getCreateErrorCount()
Specified by:
getCreateErrorCount in interface DruidAbstractDataSourceMBean

getMaxActive

public int getMaxActive()
Specified by:
getMaxActive in interface DruidAbstractDataSourceMBean

setMaxActive

public abstract void setMaxActive(int maxActive)
Specified by:
setMaxActive in interface DruidAbstractDataSourceMBean

getUsername

public String getUsername()
Specified by:
getUsername in interface DruidAbstractDataSourceMBean

setUsername

public void setUsername(String username)

getPassword

public String getPassword()

setPassword

public void setPassword(String password)

getConnectProperties

public Properties getConnectProperties()
Specified by:
getConnectProperties in interface DataSourceProxy

setConnectProperties

public abstract void setConnectProperties(Properties properties)

setConnectionProperties

public void setConnectionProperties(String connectionProperties)

getUrl

public String getUrl()
Specified by:
getUrl in interface DruidAbstractDataSourceMBean
Specified by:
getUrl in interface DataSourceProxy

getRawJdbcUrl

public String getRawJdbcUrl()
Specified by:
getRawJdbcUrl in interface DataSourceProxy

setUrl

public void setUrl(String jdbcUrl)

getDriverClassName

public String getDriverClassName()
Specified by:
getDriverClassName in interface DruidAbstractDataSourceMBean

setDriverClassName

public void setDriverClassName(String driverClass)

getDriverClassLoader

public ClassLoader getDriverClassLoader()

setDriverClassLoader

public void setDriverClassLoader(ClassLoader driverClassLoader)

getLogWriter

public PrintWriter getLogWriter()
Specified by:
getLogWriter in interface CommonDataSource

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws SQLException
Specified by:
setLogWriter in interface CommonDataSource
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
Specified by:
setLoginTimeout in interface CommonDataSource

getLoginTimeout

public int getLoginTimeout()
Specified by:
getLoginTimeout in interface DruidAbstractDataSourceMBean
Specified by:
getLoginTimeout in interface CommonDataSource

getDriver

public Driver getDriver()

setDriver

public void setDriver(Driver driver)

getDriverMajorVersion

public int getDriverMajorVersion()
Specified by:
getDriverMajorVersion in interface DruidAbstractDataSourceMBean

getDriverMinorVersion

public int getDriverMinorVersion()
Specified by:
getDriverMinorVersion in interface DruidAbstractDataSourceMBean

getExceptionSorter

public ExceptionSorter getExceptionSorter()

getExceptionSorterClassName

public String getExceptionSorterClassName()
Specified by:
getExceptionSorterClassName in interface DruidAbstractDataSourceMBean

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:
getProxyFilters in interface DataSourceProxy

setProxyFilters

public void setProxyFilters(List<Filter> filters)

getFilterClasses

public String[] getFilterClasses()

setFilters

public void setFilters(String filters)
                throws SQLException
Throws:
SQLException

validateConnection

public void validateConnection(Connection conn)
                        throws SQLException
Throws:
SQLException

getActiveConnections

public Set<DruidPooledConnection> getActiveConnections()

getActiveConnectionStackTrace

public List<String> getActiveConnectionStackTrace()
Specified by:
getActiveConnectionStackTrace in interface DruidAbstractDataSourceMBean

getCreateTimespanNano

public long getCreateTimespanNano()

getCreateTimespanMillis

public long getCreateTimespanMillis()
Specified by:
getCreateTimespanMillis in interface DruidAbstractDataSourceMBean

getRawDriver

public Driver getRawDriver()
Specified by:
getRawDriver in interface DataSourceProxy

createConnectionId

public long createConnectionId()
Specified by:
createConnectionId in interface DataSourceProxy

createStatementId

public long createStatementId()
Specified by:
createStatementId in interface DataSourceProxy

createResultSetId

public long createResultSetId()
Specified by:
createResultSetId in interface DataSourceProxy

createTransactionId

public long createTransactionId()
Specified by:
createTransactionId in interface DataSourceProxy

handleConnectionException

public abstract void handleConnectionException(DruidPooledConnection pooledConnection,
                                               Throwable t)
                                        throws SQLException
Throws:
SQLException

createPhysicalConnection

public Connection createPhysicalConnection(String url,
                                           Properties info)
                                    throws SQLException
Throws:
SQLException

createPhysicalConnection

public Connection createPhysicalConnection()
                                    throws SQLException
Throws:
SQLException

initPhysicalConnection

public void initPhysicalConnection(Connection conn)
                            throws SQLException
Throws:
SQLException

getActivePeak

public abstract int getActivePeak()

getCompositeData

public CompositeDataSupport getCompositeData()
                                      throws JMException
Throws:
JMException

getID

public long getID()

getCreatedTime

public Date getCreatedTime()
Specified by:
getCreatedTime in interface DruidAbstractDataSourceMBean

getRawDriverMajorVersion

public abstract int getRawDriverMajorVersion()
Specified by:
getRawDriverMajorVersion in interface DruidAbstractDataSourceMBean

getRawDriverMinorVersion

public abstract int getRawDriverMinorVersion()
Specified by:
getRawDriverMinorVersion in interface DruidAbstractDataSourceMBean

getProperties

public abstract String getProperties()
Specified by:
getProperties in interface DruidAbstractDataSourceMBean

getParentLogger

public Logger getParentLogger()
                       throws SQLFeatureNotSupportedException
Throws:
SQLFeatureNotSupportedException

closePreapredStatement

public void closePreapredStatement(PreparedStatementHolder stmtHolder)

discardConnection

public abstract void discardConnection(Connection realConnection)


Copyright © 2012 Alibaba Group. All Rights Reserved.