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

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

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

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

Loading…
Cancel
Save