fix:add log and adjust details

pull/1127/head
hezijian 3 years ago
parent 8ad8f747e9
commit 0613a92cda

@ -63,7 +63,6 @@ import cn.hippo4j.springboot.starter.support.DynamicThreadPoolConfigService;
import cn.hippo4j.springboot.starter.support.DynamicThreadPoolPostProcessor;
import cn.hippo4j.springboot.starter.support.ThreadPoolPluginRegisterPostProcessor;
import lombok.AllArgsConstructor;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@ -250,7 +249,7 @@ public class DynamicThreadPoolAutoConfiguration {
}
@Bean
public ClientShutdown clientShutdown() {
public ClientShutdown hippo4jClientShutdown() {
return new ClientShutdown();
}
}

@ -21,6 +21,9 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import lombok.Getter;
/**
* Client Shutdown
*/
public class ClientShutdown {
@Getter

@ -115,8 +115,7 @@ public class DiscoveryClient implements DisposableBean {
}
private void prepareDestroy() throws InterruptedException {
// close scheduled
this.scheduler.shutdown();
this.scheduler.shutdownNow();
// try to make sure the ClientWorker is closed first
ApplicationContextHolder.getBean(ClientShutdown.class).prepareDestroy();
}

@ -32,10 +32,12 @@ import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
/**
* Server http agent.
*/
@Slf4j
public class ServerHttpAgent implements HttpAgent {
private final BootstrapProperties dynamicThreadPoolProperties;
@ -114,7 +116,7 @@ public class ServerHttpAgent implements HttpAgent {
isHealthStatus();
injectSecurityInfo(paramValues);
if (isPrepareClose()) {
return null;
return new Result();
}
return HttpUtil.post(buildUrl(path), headers, paramValues, readTimeoutMs, Result.class);
}
@ -141,6 +143,7 @@ public class ServerHttpAgent implements HttpAgent {
}
if (clientShutdown.isPrepareClose()) {
clientShutdown.countDown();
log.info("client prepare shutdown");
return true;
}
return false;

Loading…
Cancel
Save