src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java
changeset 54955 46409371a691
parent 50929 ef57cfcd22ff
equal deleted inserted replaced
54954:6ec71a88b68e 54955:46409371a691
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   127         }
   127         }
   128     }
   128     }
   129 
   129 
   130     protected void writeJavaThreads() throws IOException {
   130     protected void writeJavaThreads() throws IOException {
   131         Threads threads = VM.getVM().getThreads();
   131         Threads threads = VM.getVM().getThreads();
   132         JavaThread jt = threads.first();
   132         for (int i = 0; i < threads.getNumberOfThreads(); i++) {
   133         int index = 1;
   133             JavaThread jt = threads.getJavaThreadAt(i);
   134         while (jt != null) {
       
   135             if (jt.getThreadObj() != null) {
   134             if (jt.getThreadObj() != null) {
   136                 // Note that the thread serial number range is 1-to-N
   135                 // Note that the thread serial number range is 1-to-N
   137                 writeJavaThread(jt, index);
   136                 writeJavaThread(jt, i + 1);
   138                 index++;
       
   139             }
   137             }
   140             jt = jt.next();
       
   141         }
   138         }
   142     }
   139     }
   143 
   140 
   144     protected void writeJavaThread(JavaThread jt, int index)
   141     protected void writeJavaThread(JavaThread jt, int index)
   145                             throws IOException {
   142                             throws IOException {