1 16 package org.jmanage.testapp.mbeans; 17 18 import javax.management.NotificationBroadcasterSupport ; 19 import javax.management.MBeanNotificationInfo ; 20 import javax.management.Notification ; 21 22 27 public class TimeNotificationBroadcaster extends NotificationBroadcasterSupport 28 implements TimeNotificationBroadcasterMBean { 29 30 public MBeanNotificationInfo [] getNotificationInfo(){ 31 32 String type = "time.expired"; 33 MBeanNotificationInfo [] notifications = new MBeanNotificationInfo [1]; 34 notifications[0] = new MBeanNotificationInfo (new String []{type}, 35 "TimeNotification", 36 "Types of notifications emitted by this broadcaster"); 37 38 return notifications; 39 } 40 41 private int sequence = 1; 42 43 public void emitNotification(){ 44 this.sendNotification(new Notification ("time.expired", this, sequence++)); 45 } 46 } 47 | Popular Tags |