01: package org.objectweb.celtix.bus.transports.jms;
02:
03: import org.objectweb.celtix.bus.management.counters.TransportClientCounters;
04: import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedAttribute;
05: import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedResource;
06: import org.objectweb.celtix.management.Instrumentation;
07:
08: @ManagedResource(componentName="JMSClientTransport",description="The Celtix bus JMS Client Transport component ",currencyTimeLimit=15,persistPolicy="OnUpdate")
09: public class JMSClientTransportInstrumentation implements
10: Instrumentation {
11:
12: private static final String INSTRUMENTATION_NAME = "Bus.Service.Port.JMSClientTransport";
13:
14: private static int instanceNumber;
15:
16: JMSClientTransport jmsClientTransport;
17: String objectName;
18: TransportClientCounters counters;
19:
20: public JMSClientTransportInstrumentation(
21: JMSClientTransport jmsTransport) {
22: jmsClientTransport = jmsTransport;
23: counters = jmsTransport.counters;
24: objectName = "JMSClientTransport" + instanceNumber;
25: instanceNumber++;
26: }
27:
28: public static void resetInstanceNumber() {
29: instanceNumber = 0;
30: }
31:
32: @ManagedAttribute(description="The JMS client invoke counter",persistPolicy="OnUpdate")
33: public int getInvoke() {
34: return counters.getInvoke().getValue();
35: }
36:
37: @ManagedAttribute(description="The JMS client invoke Async counter",persistPolicy="OnUpdate")
38: public int getInvokeAsync() {
39: return counters.getInvokeAsync().getValue();
40: }
41:
42: @ManagedAttribute(description="The JMS client one way invoke counter",persistPolicy="OnUpdate")
43: public int getInvokeOneWay() {
44: return counters.getInvokeOneWay().getValue();
45: }
46:
47: @ManagedAttribute(description="The JMS client error invoke counter",persistPolicy="OnUpdate")
48: public int getInvokeError() {
49: return counters.getInvokeError().getValue();
50: }
51:
52: public Object getComponent() {
53: return jmsClientTransport;
54: }
55:
56: public String getInstrumentationName() {
57: return INSTRUMENTATION_NAME;
58: }
59:
60: public String getUniqueInstrumentationName() {
61: return objectName;
62: }
63: }
|