public static void main(String[] args) { JmxDemo demo=new JmxDemo(); demo.addNotificationListener((notification, handback) -> System.out.println(">> " + notification + ", handback=" + handback), null, "myHandback"); demo.startNotifications(); MBeanServer server=Util.getMBeanServer(); if(server != null) { try { JmxConfigurator.register(demo, server, "demo:name=DemoObject"); while(true) { Util.sleep(10000); } } catch(Exception e) { e.printStackTrace(); } } }
@Override public void run() { int cnt=1; while(true) { Util.sleep(1000); MyNotification notif=new MyNotification("home.grown", this, cnt, "hello-" + cnt); notif.setName("Bela Ban"); cnt++; sendNotification(notif); } } }.start();
public static void main(String[] args) { JmxDemo demo=new JmxDemo(); demo.addNotificationListener((notification, handback) -> System.out.println(">> " + notification + ", handback=" + handback), null, "myHandback"); demo.startNotifications(); MBeanServer server=Util.getMBeanServer(); if(server != null) { try { JmxConfigurator.register(demo, server, "demo:name=DemoObject"); while(true) { Util.sleep(10000); } } catch(Exception e) { e.printStackTrace(); } } }
@Override public void run() { int cnt=1; while(true) { Util.sleep(1000); MyNotification notif=new MyNotification("home.grown", this, cnt, "hello-" + cnt); notif.setName("Bela Ban"); cnt++; sendNotification(notif); } } }.start();