1 22 package org.jboss.test.jmx.compliance.server.support; 23 24 import javax.management.ListenerNotFoundException ; 25 import javax.management.MBeanNotificationInfo ; 26 import javax.management.Notification ; 27 import javax.management.NotificationBroadcaster ; 28 import javax.management.NotificationBroadcasterSupport ; 29 import javax.management.NotificationFilter ; 30 import javax.management.NotificationListener ; 31 32 36 public class BroadcasterInvocationHandlerTest 37 extends InvocationHandlerTest 38 implements NotificationBroadcaster 39 { 40 NotificationBroadcasterSupport emitter = new NotificationBroadcasterSupport (); 41 42 public void addNotificationListener(NotificationListener listener, 43 NotificationFilter filter, 44 Object handback) 45 { 46 emitter.addNotificationListener(listener, filter, handback); 47 } 48 49 public MBeanNotificationInfo [] getNotificationInfo() 50 { 51 String [] types = { "test" }; 52 return new MBeanNotificationInfo [] 53 { 54 new MBeanNotificationInfo (types, "name", "description") 55 }; 56 } 57 58 public void removeNotificationListener(NotificationListener listener) 59 throws ListenerNotFoundException 60 { 61 emitter.removeNotificationListener(listener); 62 } 63 64 public void sendNotification() 65 { 66 Notification notification = new Notification ("test", this, 1l); 67 emitter.sendNotification(notification); 68 } 69 } | Popular Tags |