Skip to content

Commit

Permalink
update destruction log and give better messages
Browse files Browse the repository at this point in the history
  • Loading branch information
yanlinly authored and SoilChang committed Jan 2, 2025
1 parent 14becb8 commit 90a118a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ public static ConfigHttpClientManager getInstance() {

@Override
public void shutdown() throws NacosException {
NAMING_LOGGER.warn("[ConfigHttpClientManager] Start destroying NacosRestTemplate");
NAMING_LOGGER.info("[ConfigHttpClientManager] Start destroying NacosRestTemplate");
try {
HttpClientBeanHolder.shutdownNacosSyncRest(HTTP_CLIENT_FACTORY.getClass().getName());
} catch (Exception ex) {
NAMING_LOGGER.error("[ConfigHttpClientManager] An exception occurred when the HTTP client was closed : {}",
ExceptionUtil.getStackTrace(ex));
}
NAMING_LOGGER.warn("[ConfigHttpClientManager] Destruction of the end");
NAMING_LOGGER.info("[ConfigHttpClientManager] Completed destruction of NacosRestTemplate");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ public NacosRestTemplate getNacosRestTemplate() {

@Override
public void shutdown() throws NacosException {
NAMING_LOGGER.warn("[NamingHttpClientManager] Start destroying NacosRestTemplate");
NAMING_LOGGER.info("[NamingHttpClientManager] Start destroying NacosRestTemplate");
try {
HttpClientBeanHolder.shutdownNacosSyncRest(HTTP_CLIENT_FACTORY.getClass().getName());
} catch (Exception ex) {
NAMING_LOGGER.error("[NamingHttpClientManager] An exception occurred when the HTTP client was closed : {}",
ExceptionUtil.getStackTrace(ex));
}
NAMING_LOGGER.warn("[NamingHttpClientManager] Destruction of the end");
NAMING_LOGGER.info("[NamingHttpClientManager] Completed destruction of NacosRestTemplate");
}

private static class NamingHttpClientFactory extends AbstractHttpClientFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public final class ThreadPoolManager {
static {
INSTANCE.init();
ThreadUtils.addShutdownHook(new Thread(() -> {
LOGGER.warn("[ThreadPoolManager] Start destroying ThreadPool");
LOGGER.info("[ThreadPoolManager] Start destroying ThreadPool");
shutdown();
LOGGER.warn("[ThreadPoolManager] Destruction of the end");
LOGGER.info("[ThreadPoolManager] Completed destruction of ThreadPool");
}));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static void shutdown() {
if (!ALREADY_SHUTDOWN.compareAndSet(false, true)) {
return;
}
LOGGER.warn("[HttpClientBeanHolder] Start destroying common HttpClient");
LOGGER.info("[HttpClientBeanHolder] Start destroying common HttpClient");

try {
shutdown(DefaultHttpClientFactory.class.getName());
Expand All @@ -108,7 +108,7 @@ private static void shutdown() {
ExceptionUtil.getStackTrace(ex));
}

LOGGER.warn("[HttpClientBeanHolder] Destruction of the end");
LOGGER.info("[HttpClientBeanHolder] Completed destruction of HttpClient");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static void shutdown() {
if (!CLOSED.compareAndSet(false, true)) {
return;
}
LOGGER.warn("[NotifyCenter] Start destroying Publisher");
LOGGER.info("[NotifyCenter] Start destroying Publisher");

for (Map.Entry<String, EventPublisher> entry : INSTANCE.publisherMap.entrySet()) {
try {
Expand All @@ -148,7 +148,7 @@ public static void shutdown() {
LOGGER.error("[SharePublisher] shutdown has error : ", e);
}

LOGGER.warn("[NotifyCenter] Destruction of the end");
LOGGER.info("[NotifyCenter] Completed destruction of Publisher");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static NacosAsyncRestTemplate getNacosAsyncRestTemplate() {
}

private static void shutdown() {
LOGGER.warn("[ConfigServer-HttpClientManager] Start destroying NacosRestTemplate");
LOGGER.info("[ConfigServer-HttpClientManager] Start destroying NacosRestTemplate");
try {
final String httpClientFactoryBeanName = ConfigHttpClientFactory.class.getName();
HttpClientBeanHolder.shutdownNacosSyncRest(httpClientFactoryBeanName);
Expand All @@ -73,7 +73,7 @@ private static void shutdown() {
LOGGER.error("[ConfigServer-HttpClientManager] An exception occurred when the HTTP client was closed : {}",
ExceptionUtil.getStackTrace(ex));
}
LOGGER.warn("[ConfigServer-HttpClientManager] Destruction of the end");
LOGGER.info("[ConfigServer-HttpClientManager] Completed destruction of NacosRestTemplate");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static NacosAsyncRestTemplate getProcessorNacosAsyncRestTemplate() {
}

private static void shutdown() {
SRV_LOG.warn("[NamingServerHttpClientManager] Start destroying HTTP-Client");
SRV_LOG.info("[NamingServerHttpClientManager] Start destroying HTTP-Client");
try {
HttpClientBeanHolder.shutdownNacosSyncRest(SYNC_HTTP_CLIENT_FACTORY.getClass().getName());
HttpClientBeanHolder.shutdownNacosSyncRest(APACHE_SYNC_HTTP_CLIENT_FACTORY.getClass().getName());
Expand All @@ -114,7 +114,7 @@ private static void shutdown() {
SRV_LOG.error("[NamingServerHttpClientManager] An exception occurred when the HTTP client was closed : {}",
ExceptionUtil.getStackTrace(ex));
}
SRV_LOG.warn("[NamingServerHttpClientManager] Destruction of the end");
SRV_LOG.info("[NamingServerHttpClientManager] Completed destruction of HTTP-Client");
}

private static class AsyncHttpClientFactory extends AbstractHttpClientFactory {
Expand Down

0 comments on commit 90a118a

Please sign in to comment.