Eureka服务端源码
2020-10-20 10:00:59 0 举报
Eureka Server源码
作者其他创作
大纲/内容
registry.syncUp()
循环遍历registry(ConcurrentHashMap),将过期的注册实例添加到expiredLease中,然后遍历expiredLease,执行internalCancel方法,把实例状态修改成deleted状态,这样客户端就拿不到了
applicationInfoManager.setInstanceStatus(InstanceStatus.UP)
修改EurekaServer状态为up
registry.openForTraffic
AbstractInstanceRegistry#evict(long)
spring-cloud-netflix-eureka-server.jar
super.postInit()
@Bean
初始化EurekaServer上下文
implements SmartLifecycle
EurekaServerInitializerConfiguration#start
只读缓存
EurekaServerAutoConfiguration
开启一个定时剔除服务的任务,每60s执行一次,从当前服务清单中剔除90s没有续约的服务
timer.schedule(getCacheUpdateTask()
EurekaServerBootstrap#initEurekaServerContext
PeerAwareInstanceRegistryImpl#init
AbstractInstanceRegistry#initializedResponseCache
EurekaServerContext
DefaultEurekaServerContext#initialize
TimerTask#run()
EurekaServerBootstrap#contextInitialized
@Import(EurekaServerInitializerConfiguration.class)
EurekaServerInitializerConfiguration
每隔30s执行任务
spring.factories
读写缓存,180s过期
初始化EureakaServer的运行时环境
将读写缓存中的数据更新到只读缓存中
EurekaServerBootstrap#initEurekaEnvironment
@PostConstruct
从集群其他节点复制注册表
AbstractInstanceRegistry.EvictionTask#run
AbstractInstanceRegistry#postInit
0 条评论
下一页