• 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 }
  • 相关阅读:
    [置顶] 十年博客行
    计算机编程语言年史
    初步认知MySQL metadata lock(MDL)
    Oracle语句优化规则(二)
    正则表达式
    sql server中的 SET NOCOUNT ON 的含义
    SQO (标准查询运算符)方法 & Linq To Object
    C# 扩展
    特性
    C#之泛型
  • 原文地址:https://www.cnblogs.com/wangyonglong/p/7427181.html
Copyright © 2020-2023  润新知