版本 awsVersion = ‘1.11.277’
DiscoveryClient # cacheRefreshTask
// 配置shouldFetchRegistry
if (clientConfig.shouldFetchRegistry()) {
// 配置client.refresh.interval
int registryFetchIntervalSeconds = clientConfig
.getRegistryFetchIntervalSeconds();
// 配置expBackOffBound
int expBackOffBound = clientConfig
.getCacheRefreshExecutorExponentialBackOffBound();
cacheRefreshTask = new TimedSupervisorTask(
"cacheRefresh",
scheduler,
cacheRefreshExecutor,
registryFetchIntervalSeconds,
TimeUnit.SECONDS,
expBackOffBound,
new CacheRefreshThread()
);
scheduler.schedule(
cacheRefreshTask,
registryFetchIntervalSeconds, TimeUnit.SECONDS);
}
shouldFetchRegistry
指定是否从服务端拉取注册列表,默认 true
client.refresh.interval
指定从服务端拉取注册列表的时间间隔,默认 30s
client.cacheRefresh.exponentialBackOffBound
指定从服务端拉取注册列表的最大时间间隔,默认 10
注1:当从服务端拉取注册列表的请求超时(即 TimedSupervisorTask 捕获 TimeoutException 异常时),下一次拉取的时间间隔会成倍递增,递增后的时间间隔不能超过 client.cacheRefresh.exponentialBackOffBound
和 client.refresh.interval
的乘积(即拉取的时间间隔最大不能超过 10x30=300s)
注2:
supervisor
英
/ˈsuːpəvaɪzə®/
美
/ˈsuːpərvaɪzər/
n.
监督人;主管人;指导者
注3:
exponential
英
/ˌekspəˈnenʃl/
美
/ˌekspəˈnenʃl/
adj.
指数的;幂的;越来越快的;由指数表示的
n.
指数
DiscoveryClient # heartbeatTask