home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / management / MBeanServerDelegate.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  3.3 KB  |  106 lines

  1. package javax.management;
  2.  
  3. import com.sun.jmx.defaults.ServiceName;
  4. import java.net.InetAddress;
  5. import java.net.UnknownHostException;
  6.  
  7. public class MBeanServerDelegate implements MBeanServerDelegateMBean, NotificationEmitter {
  8.    private String mbeanServerId;
  9.    private final NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();
  10.    private static long oldStamp = 0L;
  11.    private final long stamp = getStamp();
  12.    private long sequenceNumber = 1L;
  13.    private static final MBeanNotificationInfo[] notifsInfo;
  14.    public static final ObjectName DELEGATE_NAME;
  15.  
  16.    public synchronized String getMBeanServerId() {
  17.       if (this.mbeanServerId == null) {
  18.          String var1;
  19.          try {
  20.             var1 = InetAddress.getLocalHost().getHostName();
  21.          } catch (UnknownHostException var3) {
  22.             var1 = "localhost";
  23.          }
  24.  
  25.          this.mbeanServerId = new String(var1 + "_" + this.stamp);
  26.       }
  27.  
  28.       return this.mbeanServerId;
  29.    }
  30.  
  31.    public String getSpecificationName() {
  32.       return "Java Management Extensions";
  33.    }
  34.  
  35.    public String getSpecificationVersion() {
  36.       return "1.4";
  37.    }
  38.  
  39.    public String getSpecificationVendor() {
  40.       return "Sun Microsystems";
  41.    }
  42.  
  43.    public String getImplementationName() {
  44.       return "JMX";
  45.    }
  46.  
  47.    public String getImplementationVersion() {
  48.       return ServiceName.JMX_IMPL_VERSION;
  49.    }
  50.  
  51.    public String getImplementationVendor() {
  52.       return "Sun Microsystems";
  53.    }
  54.  
  55.    public MBeanNotificationInfo[] getNotificationInfo() {
  56.       int var1 = notifsInfo.length;
  57.       MBeanNotificationInfo[] var2 = new MBeanNotificationInfo[var1];
  58.       System.arraycopy(notifsInfo, 0, var2, 0, var1);
  59.       return var2;
  60.    }
  61.  
  62.    public synchronized void addNotificationListener(NotificationListener var1, NotificationFilter var2, Object var3) throws IllegalArgumentException {
  63.       this.broadcaster.addNotificationListener(var1, var2, var3);
  64.    }
  65.  
  66.    public synchronized void removeNotificationListener(NotificationListener var1, NotificationFilter var2, Object var3) throws ListenerNotFoundException {
  67.       this.broadcaster.removeNotificationListener(var1, var2, var3);
  68.    }
  69.  
  70.    public synchronized void removeNotificationListener(NotificationListener var1) throws ListenerNotFoundException {
  71.       this.broadcaster.removeNotificationListener(var1);
  72.    }
  73.  
  74.    public void sendNotification(Notification var1) {
  75.       if (var1.getSequenceNumber() < 1L) {
  76.          synchronized(this) {
  77.             var1.setSequenceNumber((long)(this.sequenceNumber++));
  78.          }
  79.       }
  80.  
  81.       this.broadcaster.sendNotification(var1);
  82.    }
  83.  
  84.    private static synchronized long getStamp() {
  85.       long var0 = System.currentTimeMillis();
  86.       if (oldStamp >= var0) {
  87.          var0 = oldStamp + 1L;
  88.       }
  89.  
  90.       oldStamp = var0;
  91.       return var0;
  92.    }
  93.  
  94.    static {
  95.       String[] var0 = new String[]{"JMX.mbean.unregistered", "JMX.mbean.registered"};
  96.       notifsInfo = new MBeanNotificationInfo[1];
  97.       notifsInfo[0] = new MBeanNotificationInfo(var0, "javax.management.MBeanServerNotification", "Notifications sent by the MBeanServerDelegate MBean");
  98.  
  99.       try {
  100.          DELEGATE_NAME = new ObjectName("JMImplementation:type=MBeanServerDelegate");
  101.       } catch (MalformedObjectNameException var1) {
  102.          throw new Error("Can't initialize delegate name", var1);
  103.       }
  104.    }
  105. }
  106.