Class RandomDataSourceValidateThread

java.lang.Object
com.alibaba.druid.pool.ha.selector.RandomDataSourceValidateThread
All Implemented Interfaces:
Runnable

public class RandomDataSourceValidateThread extends Object implements 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 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

  • Method Details

    • logSuccessTime

      public static void logSuccessTime(DataSourceProxy dataSource)
      Provide a static method to record the last success time of a DataSource
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • 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

      public RandomDataSourceSelector getSelector()
    • setSelector

      public void setSelector(RandomDataSourceSelector selector)