Skip to content

Commit b3cb132

Browse files
committed
Maintain the DISABLE_MBEAN hint for GraalVM native images
1 parent 4ae8fd9 commit b3cb132

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/main/java/org/jboss/threads/EnhancedQueueExecutor.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -1861,13 +1861,17 @@ void completeTermination() {
18611861
waiters = waiters.getNext();
18621862
}
18631863
tail.setNext(TERMINATE_COMPLETE);
1864-
if (this.acc != null) {
1865-
final Object handle = this.handle;
1866-
if (handle != null) {
1867-
intr = intr || Thread.interrupted();
1868-
doPrivileged(new MBeanUnregisterAction(handle), acc);
1864+
if (!DISABLE_MBEAN) {
1865+
//The check for DISABLE_MBEAN is redundant as acc would be null,
1866+
//but GraalVM needs the hint so to not make JMX reachable.
1867+
if (this.acc != null) {
1868+
final Object handle = this.handle;
1869+
if (handle != null) {
1870+
intr = intr || Thread.interrupted();
1871+
doPrivileged(new MBeanUnregisterAction(handle), acc);
1872+
}
1873+
this.acc = null;
18691874
}
1870-
this.acc = null;
18711875
}
18721876
} finally {
18731877
if (intr) {

0 commit comments

Comments
 (0)