[ISSUE-#4631] Free credential instance when serverHttpAgent shutdown. (#4634)
* free credential instance when serverHttpAgent shutdown. * free credential instance when namingProxy shutdown. * unify the code place * cancel timer when CredentialWatcher stop * ignore PMD.AvoidUseTimerRule.
This commit is contained in:
parent
0732a93072
commit
a4e3b7cbc7
@ -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);
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,10 @@ public class SpasAdapter {
|
||||
return CredentialService.getInstance().getCredential().getAccessKey();
|
||||
}
|
||||
|
||||
public static void freeCredentialInstance() {
|
||||
CredentialService.freeInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign with hmac SHA1 encrtpt.
|
||||
*
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user