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
Modifier and TypeFieldDescriptionstatic final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
int
static void
logSuccessTime
(DataSourceProxy dataSource) Provide a static method to record the last success time of a DataSourcevoid
run()
void
setBlacklistThreshold
(int blacklistThreshold) void
setCheckingIntervalSeconds
(int checkingIntervalSeconds) void
setSelector
(RandomDataSourceSelector selector) void
setValidationSleepSeconds
(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
-