< prev index next >

src/java.base/share/classes/jdk/internal/vm/JcmdVThreadCommands.java

Print this page

30 import jdk.internal.access.JavaLangAccess;
31 import jdk.internal.access.SharedSecrets;
32 import sun.nio.ch.Poller;
33 
34 /**
35  * The implementation for the jcmd Thread.vthread_* diagnostic commands. These methods are
36  * called from the "Attach Listener" thread.
37  */
38 public class JcmdVThreadCommands {
39     private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
40 
41     private JcmdVThreadCommands() { }
42 
43     /**
44      * Invoked by the VM to print the virtual scheduler to a byte[].
45      */
46     private static byte[] printScheduler() {
47         StringBuilder sb = new StringBuilder();
48 
49         // virtual thread scheduler
50         sb.append(JLA.virtualThreadDefaultScheduler())
51           .append(System.lineSeparator());
52 
53         return sb.toString().getBytes(StandardCharsets.UTF_8);
54     }
55 
56     /**
57      * Invoked by the VM to print the I/O pollers to a byte[].
58      */
59     private static byte[] printPollers() {
60         StringBuilder sb = new StringBuilder();
61 
62         Poller masterPoller = Poller.masterPoller();
63         List<Poller> readPollers = Poller.readPollers();
64         List<Poller> writePollers = Poller.writePollers();
65 
66         if (masterPoller != null) {
67             sb.append("Master I/O poller:")
68               .append(System.lineSeparator())
69               .append(masterPoller)
70               .append(System.lineSeparator());

30 import jdk.internal.access.JavaLangAccess;
31 import jdk.internal.access.SharedSecrets;
32 import sun.nio.ch.Poller;
33 
34 /**
35  * The implementation for the jcmd Thread.vthread_* diagnostic commands. These methods are
36  * called from the "Attach Listener" thread.
37  */
38 public class JcmdVThreadCommands {
39     private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
40 
41     private JcmdVThreadCommands() { }
42 
43     /**
44      * Invoked by the VM to print the virtual scheduler to a byte[].
45      */
46     private static byte[] printScheduler() {
47         StringBuilder sb = new StringBuilder();
48 
49         // virtual thread scheduler
50         sb.append(JLA.defaultVirtualThreadScheduler())
51           .append(System.lineSeparator());
52 
53         return sb.toString().getBytes(StandardCharsets.UTF_8);
54     }
55 
56     /**
57      * Invoked by the VM to print the I/O pollers to a byte[].
58      */
59     private static byte[] printPollers() {
60         StringBuilder sb = new StringBuilder();
61 
62         Poller masterPoller = Poller.masterPoller();
63         List<Poller> readPollers = Poller.readPollers();
64         List<Poller> writePollers = Poller.writePollers();
65 
66         if (masterPoller != null) {
67             sb.append("Master I/O poller:")
68               .append(System.lineSeparator())
69               .append(masterPoller)
70               .append(System.lineSeparator());
< prev index next >