zoukankan      html  css  js  c++  java
  • HelloWorld

     1 package mbeanTest;
     2 
     3 import javax.management.Notification;
     4 import javax.management.NotificationBroadcasterSupport;
     5 
     6 public class HelloWorld extends NotificationBroadcasterSupport implements
     7         HelloWorldMBean
     8 {
     9 
    10     public String hello;
    11 
    12     private long seq = 0l;
    13 
    14     public HelloWorld()
    15     {
    16         this.hello = "Hello World! I am a Standard MBean";
    17     }
    18 
    19     public HelloWorld(String hello)
    20     {
    21         this.hello = hello;
    22     }
    23 
    24     public String getHello()
    25     {
    26         return hello+": 调用方法getHello()";
    27     }
    28 
    29     @Override
    30     public Object getInstance()
    31     {
    32         return new Object();
    33     }
    34 
    35     /*
    36      * 当执行message的时候,发送一个消息(事件)
    37      * 
    38      * @see test.jmx.HelloWorldMBean#message(java.lang.String)
    39      */
    40     @Override
    41     public String message(String ms)
    42     {
    43         Notification notice = new Notification("type1", this, seq++,
    44                 " the message metheod is invoked,the argument ms: " + ms);
    45         sendNotification(notice);
    46         return " the message :  ";
    47     }
    48 
    49     @Override
    50     public void setHello(String hello)
    51     {
    52         this.hello = hello;
    53     }
    54 }
  • 相关阅读:
    13-计算属性和侦听器
    12-指令系统介绍
    11-vue的使用
    10-vue的介绍
    09-babel
    08-webpack的介绍
    07-nodejs中npm的使用
    06-Nodejs介绍
    05-面向对象
    Docker结合Jenkins构建持续集成环境
  • 原文地址:https://www.cnblogs.com/wangyonglong/p/7427181.html
Copyright © 2011-2022 走看看