Package com.alibaba.druid.pool.ha
Class HighAvailableDataSource
java.lang.Object
com.alibaba.druid.pool.WrapperAdapter
com.alibaba.druid.pool.ha.HighAvailableDataSource
- All Implemented Interfaces:
Wrapper
,CommonDataSource
,DataSource
DataSource class which contains multiple DataSource objects.
- Author:
- DigitalSonic
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBlackList
(String name) void
close()
void
destroy()
getConnection
(String username, String password) int
int
int
long
int
long
long
int
long
int
int
long
long
long
int
int
void
init()
boolean
boolean
isInBlackList
(String name) boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
removeBlackList
(String name) void
setAllowEmptyPoolWhenUpdate
(boolean allowEmptyPoolWhenUpdate) void
setConnectionProperties
(String connectionProperties) void
setConnectProperties
(Properties connectProperties) void
setDataSourceFile
(String dataSourceFile) void
setDataSourceMap
(Map<String, DataSource> dataSourceMap) void
setDataSourceSelector
(DataSourceSelector dataSourceSelector) void
setDriverClassName
(String driverClassName) void
setFilters
(String filters) void
setInitialSize
(int initialSize) void
setLogAbandoned
(boolean logAbandoned) void
setLoginTimeout
(int seconds) void
setLogWriter
(PrintWriter out) void
setMaxActive
(int maxActive) void
setMaxEvictableIdleTimeMillis
(long maxEvictableIdleTimeMillis) void
setMaxPoolPreparedStatementPerConnectionSize
(int maxPoolPreparedStatementPerConnectionSize) void
setMaxWait
(long maxWait) void
setMinEvictableIdleTimeMillis
(long minEvictableIdleTimeMillis) void
setMinIdle
(int minIdle) void
setNodeListener
(NodeListener nodeListener) void
setPhyTimeoutMillis
(long phyTimeoutMillis) void
setPoolPreparedStatements
(boolean poolPreparedStatements) void
setPoolPurgeIntervalSeconds
(int poolPurgeIntervalSeconds) void
setPropertyPrefix
(String propertyPrefix) void
setProxyFilters
(List<Filter> proxyFilters) void
setQueryTimeout
(int queryTimeout) void
setRemoveAbandoned
(boolean removeAbandoned) void
setRemoveAbandonedTimeoutMillis
(long removeAbandonedTimeoutMillis) void
setSelector
(String name) void
setSharePreparedStatements
(boolean sharePreparedStatements) void
setTargetDataSource
(String targetName) 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
setValidationQuery
(String validationQuery) void
setValidationQueryTimeout
(int validationQueryTimeout) 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
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Constructor Details
-
HighAvailableDataSource
public HighAvailableDataSource()
-
-
Method Details
-
init
public void init() -
close
public void close() -
destroy
public void destroy() -
setTargetDataSource
-
getConnection
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getDataSourceFile
-
setDataSourceFile
-
getPropertyPrefix
-
setPropertyPrefix
-
setDataSourceMap
-
getDataSourceMap
-
getAvailableDataSourceMap
-
addBlackList
-
removeBlackList
-
isInBlackList
-
setSelector
-
getSelector
-
getConnection
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) - Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
-
getLoginTimeout
public int getLoginTimeout()- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
-
getParentLogger
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-
setConnectionProperties
-
setConnectProperties
-
isAllowEmptyPoolWhenUpdate
public boolean isAllowEmptyPoolWhenUpdate() -
setAllowEmptyPoolWhenUpdate
public void setAllowEmptyPoolWhenUpdate(boolean allowEmptyPoolWhenUpdate) -
getPoolPurgeIntervalSeconds
public int getPoolPurgeIntervalSeconds() -
setPoolPurgeIntervalSeconds
public void setPoolPurgeIntervalSeconds(int poolPurgeIntervalSeconds) -
getNodeListener
-
setNodeListener
-
getDataSourceSelector
-
setDataSourceSelector
-
getLogWriter
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- Throws:
SQLException
-
getDriverClassName
-
setDriverClassName
-
getConnectProperties
-
getInitialSize
public int getInitialSize() -
setInitialSize
public void setInitialSize(int initialSize) -
getMaxActive
public int getMaxActive() -
setMaxActive
public void setMaxActive(int maxActive) -
getMinIdle
public int getMinIdle() -
setMinIdle
public void setMinIdle(int minIdle) -
getMaxWait
public long getMaxWait() -
setMaxWait
public void setMaxWait(long maxWait) -
getValidationQuery
-
setValidationQuery
-
getValidationQueryTimeout
public int getValidationQueryTimeout() -
setValidationQueryTimeout
public void setValidationQueryTimeout(int validationQueryTimeout) -
isTestOnBorrow
public boolean isTestOnBorrow() -
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow) -
isTestOnReturn
public boolean isTestOnReturn() -
setTestOnReturn
public void setTestOnReturn(boolean testOnReturn) -
isTestWhileIdle
public boolean isTestWhileIdle() -
setTestWhileIdle
public void setTestWhileIdle(boolean testWhileIdle) -
isPoolPreparedStatements
public boolean isPoolPreparedStatements() -
setPoolPreparedStatements
public void setPoolPreparedStatements(boolean poolPreparedStatements) -
getMaxPoolPreparedStatementPerConnectionSize
public int getMaxPoolPreparedStatementPerConnectionSize() -
setMaxPoolPreparedStatementPerConnectionSize
public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) -
getQueryTimeout
public int getQueryTimeout() -
setQueryTimeout
public void setQueryTimeout(int queryTimeout) -
getTransactionQueryTimeout
public int getTransactionQueryTimeout() -
setTransactionQueryTimeout
public void setTransactionQueryTimeout(int transactionQueryTimeout) -
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis() -
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) -
getMinEvictableIdleTimeMillis
public long getMinEvictableIdleTimeMillis() -
setMinEvictableIdleTimeMillis
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) -
getMaxEvictableIdleTimeMillis
public long getMaxEvictableIdleTimeMillis() -
setMaxEvictableIdleTimeMillis
public void setMaxEvictableIdleTimeMillis(long maxEvictableIdleTimeMillis) -
getPhyTimeoutMillis
public long getPhyTimeoutMillis() -
setPhyTimeoutMillis
public void setPhyTimeoutMillis(long phyTimeoutMillis) -
getTimeBetweenConnectErrorMillis
public long getTimeBetweenConnectErrorMillis() -
setTimeBetweenConnectErrorMillis
public void setTimeBetweenConnectErrorMillis(long timeBetweenConnectErrorMillis) -
isRemoveAbandoned
public boolean isRemoveAbandoned() -
setRemoveAbandoned
public void setRemoveAbandoned(boolean removeAbandoned) -
getRemoveAbandonedTimeoutMillis
public long getRemoveAbandonedTimeoutMillis() -
setRemoveAbandonedTimeoutMillis
public void setRemoveAbandonedTimeoutMillis(long removeAbandonedTimeoutMillis) -
isLogAbandoned
public boolean isLogAbandoned() -
setLogAbandoned
public void setLogAbandoned(boolean logAbandoned) -
getConnectionProperties
-
getFilters
-
setFilters
-
getProxyFilters
-
setProxyFilters
-