Skip to content

Commit 4fbf22b

Browse files
author
Alan Bateman
committed
8320652: ThreadInfo.isInNative needs to be updated to say what executing native code means
Reviewed-by: mchung
1 parent 672f373 commit 4fbf22b

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/java.management/share/classes/java/lang/management/ThreadInfo.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
package java.lang.management;
2727

28+
import java.lang.foreign.Linker;
2829
import javax.management.openmbean.ArrayType;
2930
import javax.management.openmbean.CompositeData;
3031
import sun.management.ManagementFactoryHelper;
@@ -544,11 +545,21 @@ public boolean isSuspended() {
544545
}
545546

546547
/**
547-
* Tests if the thread associated with this {@code ThreadInfo}
548-
* is executing native code via the Java Native Interface (JNI).
549-
* The JNI native code does not include
550-
* the virtual machine support code or the compiled native
551-
* code generated by the virtual machine.
548+
* Tests if the thread associated with this {@code ThreadInfo} is executing
549+
* native code.
550+
*
551+
* <p> A thread is considered to be executing native code when it is executing a
552+
* native method, executing native code invoked using a {@linkplain
553+
* Linker#downcallHandle(java.lang.foreign.FunctionDescriptor, Linker.Option...)
554+
* method handle} obtained from the {@linkplain Linker native linker}, or is
555+
* <a href="{@docRoot}/../specs/jni/invocation.html#attachcurrentthread">
556+
* attached</a> to the VM with the <a href="{@docRoot}/../specs/jni/index.html">
557+
* Java Native Interface</a> with no Java frames on its stack.
558+
*
559+
* <p> Native code does not include Java virtual machine support code,
560+
* compiled code generated by the Java virtual machine, or special cases
561+
* such as a thread blocked on a <a href="{@docRoot}/../specs/jvmti.html#RawMonitors">
562+
* JVM TI raw monitor</a>.
552563
*
553564
* @return {@code true} if the thread is executing native code;
554565
* {@code false} otherwise.

0 commit comments

Comments
 (0)