Skip to content

Instantly share code, notes, and snippets.

@cleantutorials
Created May 25, 2020 23:29
Show Gist options
  • Save cleantutorials/fffaf4b00f1902e563c932111d33d78d to your computer and use it in GitHub Desktop.
Save cleantutorials/fffaf4b00f1902e563c932111d33d78d to your computer and use it in GitHub Desktop.
package com.cleantutorials.jconsole.mbeans;
import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
import javax.management.ObjectName;
public class Main {
public static void main(String[] args) throws Exception {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("com.cleantutorials.jconsole.mbeans:type=ToDo");
ToDo toDo = new ToDo();
server.registerMBean(toDo, name);
Thread.sleep(Long.MAX_VALUE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment