Registration data after hippo4j server downtime recovery

pull/233/head
chen.ma 2 years ago
parent d74bc889fd
commit 99ca166fde

@ -18,13 +18,14 @@
package cn.hippo4j.springboot.starter.core;
import cn.hippo4j.common.api.ClientCloseHookExecute;
import cn.hippo4j.common.config.ApplicationContextHolder;
import cn.hippo4j.common.constant.Constants;
import cn.hippo4j.common.model.InstanceInfo;
import cn.hippo4j.common.web.base.Result;
import cn.hippo4j.common.web.base.Results;
import cn.hippo4j.common.web.exception.ErrorCodeEnum;
import cn.hippo4j.springboot.starter.remote.HttpAgent;
import cn.hippo4j.core.executor.support.ThreadFactoryBuilder;
import cn.hippo4j.springboot.starter.remote.HttpAgent;
import cn.hutool.core.text.StrBuilder;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
@ -138,6 +139,9 @@ public class DiscoveryClient implements DisposableBean {
if (StrUtil.equals(ErrorCodeEnum.NOT_FOUND.getCode(), renewResult.getCode())) {
long timestamp = instanceInfo.setIsDirtyWithTime();
boolean success = register();
// TODO Abstract server registration logic
ThreadPoolAdapterRegister adapterRegister = ApplicationContextHolder.getBean(ThreadPoolAdapterRegister.class);
adapterRegister.register();
if (success) {
instanceInfo.unsetIsDirty(timestamp);
}

@ -57,6 +57,10 @@ public class ThreadPoolAdapterRegister implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
register();
}
public void register() {
Map<String, ThreadPoolAdapter> threadPoolAdapterMap = ApplicationContextHolder.getBeansOfType(ThreadPoolAdapter.class);
List<ThreadPoolAdapterCacheConfig> cacheConfigList = Lists.newArrayList();
threadPoolAdapterMap.forEach((key, val) -> {

Loading…
Cancel
Save