public class RandomDataSourceSelector extends Object implements DataSourceSelector
| 限定符和类型 | 字段和说明 |
|---|---|
private List<DataSource> |
blacklist |
private int |
blacklistThreshold |
private int |
checkingIntervalSeconds |
private HighAvailableDataSource |
highAvailableDataSource |
private static Log |
LOG |
static String |
PROP_BLACKLIST_THRESHOLD |
static String |
PROP_CHECKING_INTERVAL |
private static String |
PROP_PREFIX |
static String |
PROP_RECOVERY_INTERVAL |
static String |
PROP_VALIDATION_SLEEP |
private Random |
random |
private RandomDataSourceRecoverThread |
recoverThread |
private int |
recoveryIntervalSeconds |
private RandomDataSourceValidateThread |
validateThread |
private int |
validationSleepSeconds |
| 构造器和说明 |
|---|
RandomDataSourceSelector(HighAvailableDataSource highAvailableDataSource) |
private static final Log LOG
private Random random
private List<DataSource> blacklist
private HighAvailableDataSource highAvailableDataSource
private RandomDataSourceValidateThread validateThread
private RandomDataSourceRecoverThread recoverThread
private int checkingIntervalSeconds
private int recoveryIntervalSeconds
private int validationSleepSeconds
private int blacklistThreshold
public RandomDataSourceSelector(HighAvailableDataSource highAvailableDataSource)
public void init()
init 在接口中 DataSourceSelectorpublic String getName()
getName 在接口中 DataSourceSelectorpublic DataSource get()
get 在接口中 DataSourceSelectorpublic void setTarget(String name)
setTarget 在接口中 DataSourceSelectorpublic Map<String,DataSource> getDataSourceMap()
public List<DataSource> getBlacklist()
public boolean containInBlacklist(DataSource dataSource)
public void addBlacklist(DataSource dataSource)
public void removeBlacklist(DataSource dataSource)
private void loadProperties()
private int loadInteger(String name, int defaultValue)
private void initThreads()
public HighAvailableDataSource getHighAvailableDataSource()
public RandomDataSourceValidateThread getValidateThread()
public void setValidateThread(RandomDataSourceValidateThread validateThread)
public RandomDataSourceRecoverThread getRecoverThread()
public void setRecoverThread(RandomDataSourceRecoverThread recoverThread)
public int getCheckingIntervalSeconds()
public void setCheckingIntervalSeconds(int checkingIntervalSeconds)
public int getRecoveryIntervalSeconds()
public void setRecoveryIntervalSeconds(int recoveryIntervalSeconds)
public int getValidationSleepSeconds()
public void setValidationSleepSeconds(int validationSleepSeconds)
public int getBlacklistThreshold()
public void setBlacklistThreshold(int blacklistThreshold)
Copyright © 2013–2019 Alibaba Group. All rights reserved.