Class RandomDataSourceValidateThread
java.lang.Object
com.alibaba.druid.pool.ha.selector.RandomDataSourceValidateThread
- All Implemented Interfaces:
Runnable
A Thread trying to test all DataSource provided by HADataSource.
If a DataSource failed this test for 3 times (default value), it will be put into a blacklist.
- Author:
- DigitalSonic
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintintstatic voidlogSuccessTime(DataSourceProxy dataSource) Provide a static method to record the last success time of a DataSourcevoidrun()voidsetBlacklistThreshold(int blacklistThreshold) voidsetCheckingIntervalSeconds(int checkingIntervalSeconds) voidsetSelector(RandomDataSourceSelector selector) voidsetValidationSleepSeconds(int validationSleepSeconds)
-
Field Details
-
DEFAULT_CHECKING_INTERVAL_SECONDS
public static final int DEFAULT_CHECKING_INTERVAL_SECONDS- See Also:
-
DEFAULT_BLACKLIST_THRESHOLD
public static final int DEFAULT_BLACKLIST_THRESHOLD- See Also:
-
-
Constructor Details
-
RandomDataSourceValidateThread
-
-
Method Details
-
logSuccessTime
Provide a static method to record the last success time of a DataSource -
run
public void run() -
getCheckingIntervalSeconds
public int getCheckingIntervalSeconds() -
setCheckingIntervalSeconds
public void setCheckingIntervalSeconds(int checkingIntervalSeconds) -
getValidationSleepSeconds
public int getValidationSleepSeconds() -
setValidationSleepSeconds
public void setValidationSleepSeconds(int validationSleepSeconds) -
getBlacklistThreshold
public int getBlacklistThreshold() -
setBlacklistThreshold
public void setBlacklistThreshold(int blacklistThreshold) -
getSelector
-
setSelector
-