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

MDC ThreadLocal Clearence Issues #3262

Closed
Closed
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 @@ -61,16 +61,20 @@ public void invoke(Request request, Response response) throws IOException, Servl
} catch (Exception e) {
log.error("Could not handle request: " + request.getRequestURI(), e);
} finally {
MDC.remove(CarbonConstants.LogEventConstants.CLIENT_COMPONENT);
MDC.remove(MultitenantConstants.TENANT_ID);
MDC.remove(MultitenantConstants.TENANT_DOMAIN);
MDC.remove("appName");
unsetMDCThreadLocals();
// This will destroy the carbon context holder on the current thread after
// invoking subsequent valves.
PrivilegedCarbonContext.destroyCurrentContext();
}
}

private void unsetMDCThreadLocals(){

MDC.remove(MultitenantConstants.TENANT_ID);
MDC.remove(MultitenantConstants.TENANT_DOMAIN);
MDC.remove("appName");
}

public void initCarbonContext(Request request) throws Exception {
String tenantDomain;
String appName;
Expand Down