com.alibaba.druid.pool.ha
Class MultiDataSource
java.lang.Object
com.alibaba.druid.pool.WrapperAdapter
com.alibaba.druid.pool.DataSourceAdapter
com.alibaba.druid.pool.ha.MultiDataSource
- All Implemented Interfaces:
- MultiDataSourceMBean, DataSourceProxy, Wrapper, CommonDataSource, DataSource
- Direct Known Subclasses:
- CobarDataSource, HADataSource
public class MultiDataSource
- extends DataSourceAdapter
- implements MultiDataSourceMBean, DataSourceProxy
MultiDataSource
public MultiDataSource()
getMaxWaitMillis
public long getMaxWaitMillis()
setMaxWaitMillis
public void setMaxWaitMillis(long maxWaitMillis)
setMaxWait
public void setMaxWait(long seconds)
getMaxWait
public long getMaxWait()
getMaxPoolSize
public int getMaxPoolSize()
- Specified by:
getMaxPoolSize in interface MultiDataSourceMBean
setMaxPoolSize
public void setMaxPoolSize(int maxPoolSize)
throws SQLException
- Throws:
SQLException
getConfigLoader
public ConfigLoader getConfigLoader()
setConfigLoader
public void setConfigLoader(ConfigLoader configLoader)
getName
public String getName()
- Specified by:
getName in interface DataSourceProxy
getNameInternal
public String getNameInternal()
setName
public void setName(String name)
isIntited
public boolean isIntited()
isEnable
public boolean isEnable()
setEnable
public void setEnable(boolean enable)
getObjectName
public ObjectName getObjectName()
setObjectName
public void setObjectName(ObjectName objectName)
init
public void init()
throws SQLException
- Throws:
SQLException
startConfigLoadScheduleTask
public boolean startConfigLoadScheduleTask()
- Specified by:
startConfigLoadScheduleTask in interface MultiDataSourceMBean
stopConfigLoadScheduleTask
public boolean stopConfigLoadScheduleTask()
- Specified by:
stopConfigLoadScheduleTask in interface MultiDataSourceMBean
startFailureDetectScheduleTask
public boolean startFailureDetectScheduleTask()
- Specified by:
startFailureDetectScheduleTask in interface MultiDataSourceMBean
stopFailureDetectScheduleTask
public boolean stopFailureDetectScheduleTask()
- Specified by:
stopFailureDetectScheduleTask in interface MultiDataSourceMBean
resetStat
public void resetStat()
close
public void close()
failureDetect
public void failureDetect()
- Specified by:
failureDetect in interface MultiDataSourceMBean
setFailureDetectPeriodMillis
public void setFailureDetectPeriodMillis(long failureDetectPeriodMillis)
setConfigLoadPeriodMillis
public void setConfigLoadPeriodMillis(long configLoadPeriodMillis)
getFailureDetector
public DataSourceFailureDetecter getFailureDetector()
setFailureDetector
public void setFailureDetector(DataSourceFailureDetecter failureDetector)
createConnectionId
public long createConnectionId()
- Specified by:
createConnectionId in interface DataSourceProxy
createStatementId
public long createStatementId()
- Specified by:
createStatementId in interface DataSourceProxy
getDataSources
public Map<String,DataSourceHolder> getDataSources()
getDataSourceHolder
public DataSourceHolder getDataSourceHolder(String name)
addDataSource
public void addDataSource(String name,
DataSourceHolder dataSourceHolder)
getProperties
public Properties getProperties()
getActiveCount
public long getActiveCount()
- Specified by:
getActiveCount in interface MultiDataSourceMBean
notFailSignal
public void notFailSignal()
afterDataSourceChanged
public void afterDataSourceChanged(Object event)
getConnection
public Connection getConnection()
throws SQLException
- Specified by:
getConnection in interface DataSource- Overrides:
getConnection in class DataSourceAdapter
- Throws:
SQLException
getRealConnection
public MultiConnectionHolder getRealConnection(MultiDataSourceConnection multiConn,
String sql)
throws SQLException
- Throws:
SQLException
getEnabledDataSourceCount
public int getEnabledDataSourceCount()
handleNotAwailableDatasource
public void handleNotAwailableDatasource(DataSourceHolder dataSourceHolder)
getRetryGetConnectionCount
public long getRetryGetConnectionCount()
- Specified by:
getRetryGetConnectionCount in interface MultiDataSourceMBean
incrementRetryGetConnectionCount
public void incrementRetryGetConnectionCount()
getLock
public Lock getLock()
getNotFail
public Condition getNotFail()
getBusySkipCount
public long getBusySkipCount()
- Specified by:
getBusySkipCount in interface MultiDataSourceMBean
incrementBusySkipCount
public void incrementBusySkipCount()
getDataSourceNames
public String[] getDataSourceNames()
- Specified by:
getDataSourceNames in interface MultiDataSourceMBean
getDbType
public String getDbType()
- Specified by:
getDbType in interface DataSourceProxy
getRawDriver
public Driver getRawDriver()
- Specified by:
getRawDriver in interface DataSourceProxy
getUrl
public String getUrl()
- Specified by:
getUrl in interface DataSourceProxy
getRawJdbcUrl
public String getRawJdbcUrl()
- Specified by:
getRawJdbcUrl in interface DataSourceProxy
getProxyFilters
public List<Filter> getProxyFilters()
- Specified by:
getProxyFilters in interface DataSourceProxy
createResultSetId
public long createResultSetId()
- Specified by:
createResultSetId in interface DataSourceProxy
createTransactionId
public long createTransactionId()
- Specified by:
createTransactionId in interface DataSourceProxy
restartDataSource
public boolean restartDataSource(String name)
- Specified by:
restartDataSource in interface MultiDataSourceMBean
getConfigLoadCount
public long getConfigLoadCount()
- Specified by:
getConfigLoadCount in interface MultiDataSourceMBean
getFailureDetectCount
public long getFailureDetectCount()
- Specified by:
getFailureDetectCount in interface MultiDataSourceMBean
getFailureDetectPeriodMillis
public long getFailureDetectPeriodMillis()
- Specified by:
getFailureDetectPeriodMillis in interface MultiDataSourceMBean
getConfigLoadPeriodMillis
public long getConfigLoadPeriodMillis()
- Specified by:
getConfigLoadPeriodMillis in interface MultiDataSourceMBean
getDataSourceStat
public JdbcDataSourceStat getDataSourceStat()
- Specified by:
getDataSourceStat in interface DataSourceProxy
getConnectProperties
public Properties getConnectProperties()
- Specified by:
getConnectProperties in interface DataSourceProxy
Copyright © 2012 Alibaba Group. All Rights Reserved.