KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > hw > server > GreeterInstrumentation


1 package demo.hw.server;
2
3
4 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedAttribute;
5 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedOperation;
6 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedResource;
7 import org.objectweb.celtix.management.Instrumentation;
8
9 @ManagedResource(componentName = "GreeterInstrumentationName",
10                  description = "The Celtix Service instrumentation demo component ",
11                  currencyTimeLimit = -1, persistPolicy = "OnUpdate")
12 public class GreeterInstrumentation implements Instrumentation {
13     
14     private GreeterImpl greeter;
15
16     public GreeterInstrumentation(GreeterImpl gi) {
17         greeter = gi;
18     }
19
20     public String JavaDoc getInstrumentationName() {
21         return "GreeterInstrumentation";
22     }
23
24     public Object JavaDoc getComponent() {
25         return this;
26     }
27
28     public String JavaDoc getUniqueInstrumentationName() {
29         return ",name=Demo.Management";
30     }
31     
32     @ManagedAttribute(description = "Get the GreetMe call counter")
33     public Integer JavaDoc getGreetMeCounter() {
34         return greeter.requestCounters[0];
35     }
36
37     @ManagedAttribute(description = "Get the GreetMeOneWay call counter")
38     public Integer JavaDoc getGreetMeOneWayCounter() {
39         return greeter.requestCounters[1];
40     }
41
42     @ManagedAttribute(description = "Get the SayHi call counter")
43     public Integer JavaDoc getSayHiCounter() {
44         return greeter.requestCounters[2];
45     }
46
47     @ManagedAttribute(description = "Get the Ping me call counter")
48     public Integer JavaDoc getPingMeCounter() {
49         return greeter.requestCounters[3];
50     }
51
52     @ManagedAttribute(description = "Set the Ping me call counter")
53     public void setPingMeCounter(Integer JavaDoc value) {
54         greeter.requestCounters[3] = value;
55     }
56
57     @ManagedOperation(description = "set the SayHi return name",
58                       currencyTimeLimit = -1)
59     public void setSayHiReturnName(String JavaDoc name) {
60         greeter.returnName = name;
61     }
62 }
63
64
65     
66                       
67
Popular Tags