com.alibaba.druid.pool.ha
Class HADataSource

java.lang.Object
  extended by com.alibaba.druid.pool.WrapperAdapter
      extended by com.alibaba.druid.pool.DataSourceAdapter
          extended by com.alibaba.druid.pool.ha.MultiDataSource
              extended by com.alibaba.druid.pool.ha.HADataSource
All Implemented Interfaces:
HADataSourceMBean, MultiDataSourceMBean, ManagedDataSource, DataSourceProxy, Wrapper, CommonDataSource, DataSource

public class HADataSource
extends MultiDataSource
implements HADataSourceMBean, ManagedDataSource, DataSource


Constructor Summary
HADataSource()
           
 
Method Summary
 void close()
           
 DataSourceHolder getMaster()
           
 long getMasterConnectCount()
           
 String getMasterUrl()
           
 int getMasterWeight()
           
 int getMasterWeightRegionBegin()
           
 int getMasterWeightRegionEnd()
           
 DataSourceHolder getSlave()
           
 long getSlaveConnectCount()
           
 String getSlaveUrl()
           
 int getSlaveWeight()
           
 int getSlaveWeightRegionBegin()
           
 int getSlaveWeightRegionEnd()
           
 boolean isMasterEnable()
           
 boolean isMasterFail()
           
 boolean isMasterWritable()
           
 boolean isSlaveEnable()
           
 boolean isSlaveFail()
           
 boolean isSlaveWritable()
           
 void resetStat()
           
 void restartMaster()
           
 void restartSlave()
           
 void setMaster(DataSourceHolder master)
           
 DataSourceHolder setMaster(DruidDataSource master)
           
 void setMasterEnable(boolean value)
           
 void setSlave(DataSourceHolder slave)
           
 DataSourceHolder setSlave(DruidDataSource slave)
           
 void setSlaveEnable(boolean value)
           
 void switchMasterSlave()
           
 
Methods inherited from class com.alibaba.druid.pool.ha.MultiDataSource
addDataSource, afterDataSourceChanged, createConnectionId, createResultSetId, createStatementId, createTransactionId, failureDetect, getActiveCount, getBusySkipCount, getConfigLoadCount, getConfigLoader, getConfigLoadPeriodMillis, getConnection, getConnectProperties, getDataSourceHolder, getDataSourceNames, getDataSources, getDataSourceStat, getDbType, getEnabledDataSourceCount, getFailureDetectCount, getFailureDetector, getFailureDetectPeriodMillis, getLock, getMaxPoolSize, getMaxWait, getMaxWaitMillis, getName, getNameInternal, getNotFail, getObjectName, getProperties, getProxyFilters, getRawDriver, getRawJdbcUrl, getRealConnection, getRetryGetConnectionCount, getUrl, handleNotAwailableDatasource, incrementBusySkipCount, incrementRetryGetConnectionCount, init, isEnable, isIntited, notFailSignal, restartDataSource, setConfigLoader, setConfigLoadPeriodMillis, setEnable, setFailureDetector, setFailureDetectPeriodMillis, setMaxPoolSize, setMaxWait, setMaxWaitMillis, setName, setObjectName, startConfigLoadScheduleTask, startFailureDetectScheduleTask, stopConfigLoadScheduleTask, stopFailureDetectScheduleTask
 
Methods inherited from class com.alibaba.druid.pool.DataSourceAdapter
getConnection, getLoginTimeout, getLogWriter, getParentLogger, setLoginTimeout, setLogWriter
 
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.ha.MultiDataSourceMBean
failureDetect, getActiveCount, getBusySkipCount, getConfigLoadCount, getConfigLoadPeriodMillis, getDataSourceNames, getFailureDetectCount, getFailureDetectPeriodMillis, getMaxPoolSize, getRetryGetConnectionCount, restartDataSource, startConfigLoadScheduleTask, startFailureDetectScheduleTask, stopConfigLoadScheduleTask, stopFailureDetectScheduleTask
 
Methods inherited from interface com.alibaba.druid.pool.ManagedDataSource
getObjectName, isEnable, setEnable, setObjectName
 
Methods inherited from interface javax.sql.DataSource
getConnection, getConnection
 
Methods inherited from interface javax.sql.CommonDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Constructor Detail

HADataSource

public HADataSource()
Method Detail

resetStat

public void resetStat()
Specified by:
resetStat in interface HADataSourceMBean
Overrides:
resetStat in class MultiDataSource

isMasterWritable

public boolean isMasterWritable()

isSlaveWritable

public boolean isSlaveWritable()

getMasterConnectCount

public long getMasterConnectCount()
Specified by:
getMasterConnectCount in interface HADataSourceMBean

getSlaveConnectCount

public long getSlaveConnectCount()
Specified by:
getSlaveConnectCount in interface HADataSourceMBean

getMaster

public DataSourceHolder getMaster()

restartMaster

public void restartMaster()
Specified by:
restartMaster in interface HADataSourceMBean

restartSlave

public void restartSlave()
Specified by:
restartSlave in interface HADataSourceMBean

setMaster

public DataSourceHolder setMaster(DruidDataSource master)

setMaster

public void setMaster(DataSourceHolder master)

getSlave

public DataSourceHolder getSlave()

setSlave

public DataSourceHolder setSlave(DruidDataSource slave)

setSlave

public void setSlave(DataSourceHolder slave)

isMasterEnable

public boolean isMasterEnable()
Specified by:
isMasterEnable in interface HADataSourceMBean

isMasterFail

public boolean isMasterFail()
Specified by:
isMasterFail in interface HADataSourceMBean

isSlaveFail

public boolean isSlaveFail()
Specified by:
isSlaveFail in interface HADataSourceMBean

setMasterEnable

public void setMasterEnable(boolean value)
Specified by:
setMasterEnable in interface HADataSourceMBean

getMasterUrl

public String getMasterUrl()
Specified by:
getMasterUrl in interface HADataSourceMBean

getSlaveUrl

public String getSlaveUrl()
Specified by:
getSlaveUrl in interface HADataSourceMBean

getMasterWeight

public int getMasterWeight()
Specified by:
getMasterWeight in interface HADataSourceMBean

getSlaveWeight

public int getSlaveWeight()
Specified by:
getSlaveWeight in interface HADataSourceMBean

getMasterWeightRegionBegin

public int getMasterWeightRegionBegin()
Specified by:
getMasterWeightRegionBegin in interface HADataSourceMBean

getMasterWeightRegionEnd

public int getMasterWeightRegionEnd()
Specified by:
getMasterWeightRegionEnd in interface HADataSourceMBean

getSlaveWeightRegionBegin

public int getSlaveWeightRegionBegin()
Specified by:
getSlaveWeightRegionBegin in interface HADataSourceMBean

getSlaveWeightRegionEnd

public int getSlaveWeightRegionEnd()
Specified by:
getSlaveWeightRegionEnd in interface HADataSourceMBean

isSlaveEnable

public boolean isSlaveEnable()
Specified by:
isSlaveEnable in interface HADataSourceMBean

setSlaveEnable

public void setSlaveEnable(boolean value)
Specified by:
setSlaveEnable in interface HADataSourceMBean

switchMasterSlave

public void switchMasterSlave()
Specified by:
switchMasterSlave in interface HADataSourceMBean

close

public void close()
Overrides:
close in class MultiDataSource


Copyright © 2012 Alibaba Group. All Rights Reserved.