Class RandomDataSourceSelector
java.lang.Object
com.alibaba.druid.pool.ha.selector.RandomDataSourceSelector
- All Implemented Interfaces:
DataSourceSelector
- Direct Known Subclasses:
StickyRandomDataSourceSelector
A selector which uses java.util.Random to choose DataSource.
- Author:
- DigitalSonic
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBlacklist
(DataSource dataSource) boolean
containInBlacklist
(DataSource dataSource) void
destroy()
Interrupt Threads if needed.get()
Return a DataSource according to the implemention.int
int
getName()
Return the name of this DataSourceSelector.int
int
void
init()
Init the DataSourceSelector before use it.void
removeBlacklist
(DataSource dataSource) void
setBlacklistThreshold
(int blacklistThreshold) void
setCheckingIntervalSeconds
(int checkingIntervalSeconds) void
setRecoverThread
(RandomDataSourceRecoverThread recoverThread) void
setRecoveryIntervalSeconds
(int recoveryIntervalSeconds) void
Set the target DataSource name to return.void
setValidateThread
(RandomDataSourceValidateThread validateThread) void
setValidationSleepSeconds
(int validationSleepSeconds)
-
Field Details
-
PROP_CHECKING_INTERVAL
- See Also:
-
PROP_RECOVERY_INTERVAL
- See Also:
-
PROP_VALIDATION_SLEEP
- See Also:
-
PROP_BLACKLIST_THRESHOLD
- See Also:
-
-
Constructor Details
-
RandomDataSourceSelector
-
-
Method Details
-
init
public void init()Description copied from interface:DataSourceSelector
Init the DataSourceSelector before use it.- Specified by:
init
in interfaceDataSourceSelector
-
destroy
public void destroy()Interrupt Threads if needed.- Specified by:
destroy
in interfaceDataSourceSelector
-
getName
Description copied from interface:DataSourceSelector
Return the name of this DataSourceSelector. e.g. byName- Specified by:
getName
in interfaceDataSourceSelector
-
get
Description copied from interface:DataSourceSelector
Return a DataSource according to the implemention.- Specified by:
get
in interfaceDataSourceSelector
-
setTarget
Description copied from interface:DataSourceSelector
Set the target DataSource name to return. Wether to use this or not, it's decided by the implemention.- Specified by:
setTarget
in interfaceDataSourceSelector
-
getFullDataSourceMap
-
getDataSourceMap
-
getBlacklist
-
containInBlacklist
-
addBlacklist
-
removeBlacklist
-
getHighAvailableDataSource
-
getValidateThread
-
setValidateThread
-
getRecoverThread
-
setRecoverThread
-
getCheckingIntervalSeconds
public int getCheckingIntervalSeconds() -
setCheckingIntervalSeconds
public void setCheckingIntervalSeconds(int checkingIntervalSeconds) -
getRecoveryIntervalSeconds
public int getRecoveryIntervalSeconds() -
setRecoveryIntervalSeconds
public void setRecoveryIntervalSeconds(int recoveryIntervalSeconds) -
getValidationSleepSeconds
public int getValidationSleepSeconds() -
setValidationSleepSeconds
public void setValidationSleepSeconds(int validationSleepSeconds) -
getBlacklistThreshold
public int getBlacklistThreshold() -
setBlacklistThreshold
public void setBlacklistThreshold(int blacklistThreshold)
-