1 28 29 package com.caucho.jmx; 30 31 import javax.management.MBeanNotificationInfo ; 32 import javax.management.MBeanServerDelegate ; 33 import javax.management.MBeanServerNotification ; 34 import javax.management.NotificationFilter ; 35 import javax.management.NotificationListener ; 36 import javax.management.ObjectName ; 37 38 41 public class MBeanServerDelegateImpl extends MBeanServerDelegate { 42 private static final ObjectName DELEGATE_NAME; 43 44 private String _agentId; 45 private long _seq; 46 47 MBeanServerDelegateImpl(String agentId) 48 { 49 _agentId = agentId; 50 } 51 52 55 public String getMBeanServerId() 56 { 57 return _agentId; 58 } 59 60 63 public String getImplementationName() 64 { 65 return "Resin-JMX"; 66 } 67 68 71 public String getImplementationVendor() 72 { 73 return "Caucho Technology"; 74 } 75 76 79 public String getImplementationVersion() 80 { 81 return "Resin-" + com.caucho.Version.VERSION; 82 } 83 84 87 public void sendRegisterNotification(ObjectName name) 88 { 89 serverNotification(name, MBeanServerNotification.REGISTRATION_NOTIFICATION); 90 } 91 92 95 public void sendUnregisterNotification(ObjectName name) 96 { 97 serverNotification(name, MBeanServerNotification.UNREGISTRATION_NOTIFICATION); 98 } 99 100 public void addNotificationListener(NotificationListener listener, 101 NotificationFilter filter, 102 Object handback) 103 { 104 super.addNotificationListener(listener, filter, handback); 105 } 106 107 110 private void serverNotification(ObjectName name, String type) 111 { 112 MBeanServerNotification notif; 113 114 notif = new MBeanServerNotification (type, DELEGATE_NAME, _seq++, name); 115 116 sendNotification(notif); 117 } 118 119 public MBeanNotificationInfo []getNotificationInfo() 120 { 121 MBeanNotificationInfo []notifs = super.getNotificationInfo(); 122 123 return notifs; 124 } 125 126 static { 127 ObjectName name = null; 128 129 try { 130 name = new ObjectName ("JMImplementation:type=MBeanServerDelegate"); 131 } catch (Throwable e) { 132 e.printStackTrace(); 133 } 134 135 DELEGATE_NAME = name; 136 } 137 } 138 | Popular Tags |