📄 main.java
字号:
/* Main.java - main class for Hello World example. Create the HelloWorld MBean, register it, then wait forever (or until the program is interrupted). */package com.example.mbeans;import java.lang.management.*;import javax.management.*;public class Main { /* For simplicity, we declare "throws Exception". Real programs will usually want finer-grained exception handling. */ public static void main(String[] args) throws Exception { // Get the Platform MBean Server MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); // Construct the ObjectName for the MBean we will register ObjectName name = new ObjectName("com.example.mbeans:type=Hello"); // Create the Hello World MBean Hello mbean = new Hello(); // Register the Hello World MBean mbs.registerMBean(mbean, name); // Wait forever System.out.println("Waiting forever..."); Thread.sleep(Long.MAX_VALUE); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -