码迷,mamicode.com
首页 > 其他好文 > 详细

HelloWorld

时间:2017-08-25 13:44:58      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:eth   bsp   log   bean   over   tin   long   package   cas   

 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 }

 

HelloWorld

标签:eth   bsp   log   bean   over   tin   long   package   cas   

原文地址:http://www.cnblogs.com/wangyonglong/p/7427181.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!