File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
visualvm/heapviewer/src/org/graalvm/visualvm/heapviewer/java/impl Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ class JavaThreadsProvider {
71
71
72
72
73
73
static String getThreadName (Instance instance ) {
74
+ if (isVirtualThread (instance )) {
75
+ return "Virtual Thread " +DetailsSupport .getDetailsString (instance ); // NOI18N
76
+ }
74
77
String threadName = getThreadInstanceName (instance );
75
78
Long threadId = (Long )instance .getValueOfField ("tid" ); // NOI18N
76
79
Boolean daemon = (Boolean )instance .getValueOfField ("daemon" ); // NOI18N
@@ -300,6 +303,18 @@ private static String getThreadInstanceName(Instance threadInstance) {
300
303
return DetailsSupport .getDetailsString ((Instance )threadName );
301
304
}
302
305
306
+ private static boolean isVirtualThread (Instance threadInstance ) {
307
+ JavaClass threadClass = threadInstance .getJavaClass ();
308
+ Heap h = threadClass .getHeap ();
309
+ JavaClass vtClass = h .getJavaClassByName ("java.lang.VirtualThread" ); // NOI18N
310
+ if (vtClass != null ) {
311
+ for (;threadClass != null ; threadClass = threadClass .getSuperClass ()) {
312
+ if (threadClass .equals (vtClass )) return true ;
313
+ }
314
+ }
315
+ return false ;
316
+ }
317
+
303
318
private static Map <ThreadObjectGCRoot ,Map <Integer ,List <GCRoot >>> computeJavaFrameMap (Collection <GCRoot > roots ) {
304
319
Map <ThreadObjectGCRoot ,Map <Integer ,List <GCRoot >>> javaFrameMap = new HashMap ();
305
320
You can’t perform that action at this time.
0 commit comments