diff --git a/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java b/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java index 7d4a996a1..459d2f4b2 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java @@ -453,6 +453,7 @@ public class ServerHttpAgent implements HttpAgent { LOGGER.info("{} do shutdown begin", className); ThreadUtils.shutdownThreadPool(executorService, LOGGER); ConfigHttpClientManager.getInstance().shutdown(); + SpasAdapter.freeCredentialInstance(); LOGGER.info("{} do shutdown stop", className); } diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/SpasAdapter.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/SpasAdapter.java index a90694f31..9927d5976 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/SpasAdapter.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/SpasAdapter.java @@ -74,6 +74,10 @@ public class SpasAdapter { return CredentialService.getInstance().getCredential().getAccessKey(); } + public static void freeCredentialInstance() { + CredentialService.freeInstance(); + } + /** * Sign with hmac SHA1 encrtpt. * diff --git a/client/src/main/java/com/alibaba/nacos/client/identify/CredentialWatcher.java b/client/src/main/java/com/alibaba/nacos/client/identify/CredentialWatcher.java index 0794c4d71..fad15300a 100644 --- a/client/src/main/java/com/alibaba/nacos/client/identify/CredentialWatcher.java +++ b/client/src/main/java/com/alibaba/nacos/client/identify/CredentialWatcher.java @@ -53,7 +53,6 @@ public class CredentialWatcher { private final ScheduledExecutorService executor; - @SuppressWarnings("PMD.AvoidUseTimerRule") public CredentialWatcher(String appName, CredentialService serviceInstance) { this.appName = appName; this.serviceInstance = serviceInstance; diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java b/client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java index 4c99c42c3..3d777d02b 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java @@ -719,6 +719,7 @@ public class NamingProxy implements Closeable { NAMING_LOGGER.info("{} do shutdown begin", className); ThreadUtils.shutdownThreadPool(executorService, NAMING_LOGGER); NamingHttpClientManager.getInstance().shutdown(); + SpasAdapter.freeCredentialInstance(); NAMING_LOGGER.info("{} do shutdown stop", className); } }