EurekaClient源码
2020-10-20 10:00:54 0 举报
EurekaClient源码
作者其他创作
大纲/内容
增量拉取
eurekaTransport.queryClient.getApplications(remoteRegionsRef.get())
触发调用
reconcileAndLogDifference
eurekaTransport.registrationClient.register(instanceInfo);
实例状态变化时,会调用监听器的notify方法
@Bean
更新本地缓存
续约
EurekaClientAutoConfiguration
ApplicationInfoManager#setInstanceStatus
getAndUpdateDelta
statusChangeListener = new ApplicationInfoManager.StatusChangeListener()
CloudEurekaClient
EurekaAutoServiceRegistration
applicationInfoManager.registerStatusChangeListener(statusChangeListener)
initScheduledTasks
ApplicationInfoManager.StatusChangeListener#notify
存本地缓存
instanceInfoReplicator.onDemandUpdate()
EurekaServiceRegistry#register
EurekaServer服务接收心跳
fetchRegistry(remoteRegionsModified)
初始化schedulerheartbeatExecutorcacheRefreshExecutor
DiscoveryClient#renew
updateDelta(delta)
InstanceInfoReplicator#run
discoveryClient.register()
localRegionApps.set(this.filterAndShuffle(apps));
new HeartbeatThread()
全量拉取
触发监听器里的notify方法
false
eurekaTransport.queryClient.getDelta(remoteRegionsRef.get())
EurekaAutoServiceRegistration#start
cacheRefreshTask = new TimedSupervisorTask
InstanceInfoReplicator#start
DiscoveryClient#refreshRegistry
定时刷新本地服务列表
spring-cloud-netflix-eureka-client.jar
Eureka服务端服务注册
new CacheRefreshThread()
clientConfig.getRegistryRefreshSingleVipAddress() == null
getAndStoreFullRegistry()
true
往applicationInfoManager注册监听器
implements SmartLifecycle
spring.factories
实例复制
0 条评论
下一页