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
public class HighAvailableDataSource extends WrapperAdapter implements DataSource
DataSource class which contains multiple DataSource objects.- Author:
- DigitalSonic
-
-
Constructor Summary
Constructors Constructor Description HighAvailableDataSource()
-
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
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Method Detail
-
init
public void init()
-
close
public void close()
-
destroy
public void destroy()
-
setTargetDataSource
public void setTargetDataSource(String targetName)
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getDataSourceFile
public String getDataSourceFile()
-
setDataSourceFile
public void setDataSourceFile(String dataSourceFile)
-
getPropertyPrefix
public String getPropertyPrefix()
-
setPropertyPrefix
public void setPropertyPrefix(String propertyPrefix)
-
setDataSourceMap
public void setDataSourceMap(Map<String,DataSource> dataSourceMap)
-
getDataSourceMap
public Map<String,DataSource> getDataSourceMap()
-
getAvailableDataSourceMap
public Map<String,DataSource> getAvailableDataSourceMap()
-
addBlackList
public void addBlackList(String name)
-
removeBlackList
public void removeBlackList(String name)
-
isInBlackList
public boolean isInBlackList(String name)
-
setSelector
public void setSelector(String name)
-
getSelector
public String getSelector()
-
getConnection
public Connection getConnection(String username, String password) throws SQLException
- Specified by:
getConnectionin 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
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
setConnectionProperties
public void setConnectionProperties(String connectionProperties)
-
setConnectProperties
public void setConnectProperties(Properties connectProperties)
-
isAllowEmptyPoolWhenUpdate
public boolean isAllowEmptyPoolWhenUpdate()
-
setAllowEmptyPoolWhenUpdate
public void setAllowEmptyPoolWhenUpdate(boolean allowEmptyPoolWhenUpdate)
-
getPoolPurgeIntervalSeconds
public int getPoolPurgeIntervalSeconds()
-
setPoolPurgeIntervalSeconds
public void setPoolPurgeIntervalSeconds(int poolPurgeIntervalSeconds)
-
getNodeListener
public NodeListener getNodeListener()
-
setNodeListener
public void setNodeListener(NodeListener nodeListener)
-
getDataSourceSelector
public DataSourceSelector getDataSourceSelector()
-
setDataSourceSelector
public void setDataSourceSelector(DataSourceSelector dataSourceSelector)
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
getDriverClassName
public String getDriverClassName()
-
setDriverClassName
public void setDriverClassName(String driverClassName)
-
getConnectProperties
public Properties 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
public String getValidationQuery()
-
setValidationQuery
public void setValidationQuery(String validationQuery)
-
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)
-
isSharePreparedStatements
public boolean isSharePreparedStatements()
-
setSharePreparedStatements
public void setSharePreparedStatements(boolean sharePreparedStatements)
-
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
public String getConnectionProperties()
-
getFilters
public String getFilters()
-
setFilters
public void setFilters(String filters)
-
-