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