Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-#4631] Free credential instance when serverHttpAgent shutdown. #4634

Merged
merged 6 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ public void shutdown() throws NacosException {
LOGGER.info("{} do shutdown begin", className);
ThreadUtils.shutdownThreadPool(executorService, LOGGER);
ConfigHttpClientManager.getInstance().shutdown();
SpasAdapter.freeCredentialInstance();
LOGGER.info("{} do shutdown stop", className);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public static String getAk() {
return CredentialService.getInstance().getCredential().getAccessKey();
}

public static void freeCredentialInstance() {
CredentialService.freeInstance();
}

/**
* Sign with hmac SHA1 encrtpt.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ public void shutdown() throws NacosException {
NAMING_LOGGER.info("{} do shutdown begin", className);
ThreadUtils.shutdownThreadPool(executorService, NAMING_LOGGER);
NamingHttpClientManager.getInstance().shutdown();
SpasAdapter.freeCredentialInstance();
NAMING_LOGGER.info("{} do shutdown stop", className);
}
}
Expand Down