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

Set AccessControlContext to null on termination to release captured c… #109

Merged
merged 2 commits into from Aug 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/org/jboss/threads/EnhancedQueueExecutor.java
Expand Up @@ -191,7 +191,7 @@ public final class EnhancedQueueExecutor extends EnhancedQueueExecutorBase6 impl
* The access control context of the creating thread.
* Will be set to null when the MBean is not registered.
*/
private final AccessControlContext acc;
private volatile AccessControlContext acc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is volatile necessary given that it's only updated via completeTermination?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think it's better to make it volatile. It certainly doesn't hurt.

/**
* The context handler for the user-defined context.
*/
Expand Down Expand Up @@ -1867,6 +1867,7 @@ void completeTermination() {
intr = intr || Thread.interrupted();
doPrivileged(new MBeanUnregisterAction(handle), acc);
}
this.acc = null;
}
} finally {
if (intr) {
Expand Down