当前位置: 首页 > news >正文

爱站网站长工具网站备案费用

爱站网站长工具,网站备案费用,wordpress博客源码下载,wordpress某个用户重定向服务获取和服务续约 eureka客户端通过定时任务的方式进行服务获取和服务续约#xff0c;在com.netflix.discovery.DiscoveryClient类中#xff0c;启动了两个定时任务来进行处理 private void initScheduledTasks() {// 是否需要拉取if (clientConfig.shouldFetchRegistry(…服务获取和服务续约 eureka客户端通过定时任务的方式进行服务获取和服务续约在com.netflix.discovery.DiscoveryClient类中启动了两个定时任务来进行处理 private void initScheduledTasks() {// 是否需要拉取if (clientConfig.shouldFetchRegistry()) {// registry cache refresh timerint registryFetchIntervalSeconds clientConfig.getRegistryFetchIntervalSeconds();int expBackOffBound clientConfig.getCacheRefreshExecutorExponentialBackOffBound();// 拉取的定时任务时间间隔是registryFetchIntervalSecondsscheduler.schedule(new TimedSupervisorTask(cacheRefresh,scheduler,cacheRefreshExecutor,registryFetchIntervalSeconds,TimeUnit.SECONDS,expBackOffBound,new CacheRefreshThread()),registryFetchIntervalSeconds, TimeUnit.SECONDS);} // 是否需要注册if (clientConfig.shouldRegisterWithEureka()) {int renewalIntervalInSecs instanceInfo.getLeaseInfo().getRenewalIntervalInSecs();int expBackOffBound clientConfig.getHeartbeatExecutorExponentialBackOffBound();logger.info(Starting heartbeat executor: renew interval is: {}, renewalIntervalInSecs);// Heartbeat timerscheduler.schedule(new TimedSupervisorTask(heartbeat,scheduler,heartbeatExecutor,renewalIntervalInSecs,TimeUnit.SECONDS,expBackOffBound,new HeartbeatThread()),renewalIntervalInSecs, TimeUnit.SECONDS);// InstanceInfo replicatorinstanceInfoReplicator new InstanceInfoReplicator(this,instanceInfo,clientConfig.getInstanceInfoReplicationIntervalSeconds(),2); // burstSizestatusChangeListener new ApplicationInfoManager.StatusChangeListener() {Overridepublic String getId() {return statusChangeListener;}Overridepublic void notify(StatusChangeEvent statusChangeEvent) {if (InstanceStatus.DOWN statusChangeEvent.getStatus() ||InstanceStatus.DOWN statusChangeEvent.getPreviousStatus()) {// log at warn level if DOWN was involvedlogger.warn(Saw local status change event {}, statusChangeEvent);} else {logger.info(Saw local status change event {}, statusChangeEvent);}instanceInfoReplicator.onDemandUpdate();}};if (clientConfig.shouldOnDemandUpdateStatusChange()) {applicationInfoManager.registerStatusChangeListener(statusChangeListener);}instanceInfoReplicator.start(clientConfig.getInitialInstanceInfoReplicationIntervalSeconds());} else {logger.info(Not registering with Eureka server per configuration);} }来分别看一下两个定时逻辑 服务获取 线程是CacheRefreshThread看一下run方法 private boolean fetchRegistry(boolean forceFullRegistryFetch) {Stopwatch tracer FETCH_REGISTRY_TIMER.start();try {// If the delta is disabled or if it is the first time, get all// applicationsApplications applications getApplications();// 第一次拉取所有if (clientConfig.shouldDisableDelta()|| (!Strings.isNullOrEmpty(clientConfig.getRegistryRefreshSingleVipAddress()))|| forceFullRegistryFetch|| (applications null)|| (applications.getRegisteredApplications().size() 0)|| (applications.getVersion() -1)) //Client application does not have latest library supporting delta{getAndStoreFullRegistry();} else {getAndUpdateDelta(applications);}applications.setAppsHashCode(applications.getReconcileHashCode());logTotalInstances();} catch (Throwable e) {logger.error(PREFIX {} - was unable to refresh its cache! status {}, appPathIdentifier, e.getMessage(), e);return false;} finally {if (tracer ! null) {tracer.stop();}}// Notify about cache refresh before updating the instance remote status// 刷新缓存onCacheRefreshed();// Update remote status based on refreshed data held in the cacheupdateInstanceRemoteStatus();// registry was fetched successfully, so return truereturn true;}缓存刷新逻辑 if (event instanceof CacheRefreshedEvent) {if (!updateQueued.compareAndSet(false, true)) { // if an update is already queuedlogger.info(an update action is already queued, returning as no-op);return;}if (!refreshExecutor.isShutdown()) {try {refreshExecutor.submit(new Runnable() {Overridepublic void run() {try {// 更新负载均衡器中的mapupdateAction.doUpdate();lastUpdated.set(System.currentTimeMillis());} catch (Exception e) {logger.warn(Failed to update serverList, e);} finally {updateQueued.set(false);}}}); // fire and forget} catch (Exception e) {logger.warn(Error submitting update task to executor, skipping one round of updates, e);updateQueued.set(false); // if submit fails, need to reset updateQueued to false}}else {logger.debug(stopping EurekaNotificationServerListUpdater, as refreshExecutor has been shut down);stop();}}服务续约 线程是HeartbeatThread看一下run方法 boolean renew() {EurekaHttpResponseInstanceInfo httpResponse;try {// 直接发送请求进行续约很简单的逻辑httpResponse eurekaTransport.registrationClient.sendHeartBeat(instanceInfo.getAppName(), instanceInfo.getId(), instanceInfo, null);logger.debug(PREFIX {} - Heartbeat status: {}, appPathIdentifier, httpResponse.getStatusCode());if (httpResponse.getStatusCode() Status.NOT_FOUND.getStatusCode()) {REREGISTER_COUNTER.increment();logger.info(PREFIX {} - Re-registering apps/{}, appPathIdentifier, instanceInfo.getAppName());long timestamp instanceInfo.setIsDirtyWithTime();boolean success register();if (success) {instanceInfo.unsetIsDirty(timestamp);}return success;}return httpResponse.getStatusCode() Status.OK.getStatusCode();} catch (Throwable e) {logger.error(PREFIX {} - was unable to send heartbeat!, appPathIdentifier, e);return false;} }https://zhhll.icu/2023/框架/微服务/springcloud/注册中心/Eureka/源码分析/1.服务获取和服务续约/
http://www.w-s-a.com/news/892585/

相关文章:

  • 上海植物租赁做网站南浔网站建设
  • 怎么做学校网站做兼职工作上哪个网站招聘
  • 软件下载网站哪个比较好杭州开发小程序
  • 做网站都用什么技术学做名片的网站
  • 备案网站忘记密码乐装网
  • 电商扶贫网站建设淄博网站建设小程序
  • 网站群建设代理丰城网站建设公司
  • 青岛网站建设服务器wordpress迁移跳转原网站
  • 泰安网站建设哪里有公司如何注册网站
  • 做网站开专票税钱是多少个点上海市有哪些公司
  • 寿县有做网站开发的吗宁波网站建设方式
  • 网站建设和网站推广服务器怎么发布网站
  • 比较好的摄影网站雅安市政建设公司网站
  • 网站与微信区别wordpress 站内信
  • 宁夏网站开发设计说明书源码下载脚本之家
  • 邱县做网站百度搜索排名机制
  • 运城个人网站建设智慧团建系统官方网站登录
  • 公司营业执照可以做几个网站一家专门做母婴的网站
  • 网站建设商标属于哪个类别搜狗seo快速排名公司
  • 织梦做商城网站企业网络建站
  • 网站后期维护都有什么wordpress首页加图片
  • 展会网站怎么做网页设计与制作教程版徐洪亮课后答案
  • 石景山网站建设设计公司建设网站怎么建立服务器
  • 本地生活服务平台app网站关键词优化原理
  • 建网站的公司叫什么重庆论坛建站模板
  • 湖北网站制作公司银川网站建设哪家不错
  • 网站后台演示地址服装网站建设公司推荐
  • 湖北钟祥建设局网站旅游哪个网站最好
  • 浙江建设工程信息网站辽宁建设工程信息网场内业绩什么意思
  • 郑州做网站公司 汉狮网络专业图片搜集网站怎么做