01: package org.objectweb.celtix.bus.transports.jms;
02:
03: import org.objectweb.celtix.bus.management.TransportInstrumentation;
04: import org.objectweb.celtix.bus.management.counters.TransportServerCounters;
05: import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedAttribute;
06: import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedResource;
07: import org.objectweb.celtix.management.Instrumentation;
08: import org.objectweb.celtix.transports.http.configuration.HTTPServerPolicy;
09:
10: @ManagedResource(componentName="JMSServerTransport",description="The Celtix bus JMS Server Transport component ",currencyTimeLimit=15,persistPolicy="OnUpdate")
11: public class JMSServerTransportInstrumentation extends
12: TransportInstrumentation implements Instrumentation {
13: private static final String INSTRUMENTED_NAME = "Bus.Service.Port.JMSServerTransport";
14:
15: JMSServerTransport jmsServerTransport;
16: HTTPServerPolicy policy;
17: String objectName;
18: TransportServerCounters counters;
19:
20: public JMSServerTransportInstrumentation(
21: JMSServerTransport jsTransport) {
22: super (jsTransport.bus);
23: jmsServerTransport = jsTransport;
24: serviceName = findServiceName(jmsServerTransport.targetEndpoint);
25: portName = findPortName(jmsServerTransport.targetEndpoint);
26: objectName = getPortObjectName() + ",name=JMSServerTransport";
27: counters = jsTransport.counters;
28: }
29:
30: @ManagedAttribute(description="Get the Service name",persistPolicy="OnUpdate")
31: public String getServiceName() {
32: return serviceName;
33: }
34:
35: @ManagedAttribute(description="Get the Port name",persistPolicy="OnUpdate")
36: public String getPortName() {
37: return portName;
38: }
39:
40: @ManagedAttribute(description="The JMS server request error",persistPolicy="OnUpdate")
41: public int getTotalError() {
42: return counters.getTotalError().getValue();
43: }
44:
45: @ManagedAttribute(description="The JMS server total request counter",persistPolicy="OnUpdate")
46: public int getRequestTotal() {
47: return counters.getRequestTotal().getValue();
48: }
49:
50: @ManagedAttribute(description="The JMS server one way request counter",persistPolicy="OnUpdate")
51: public int getRequestOneWay() {
52: return counters.getRequestOneWay().getValue();
53: }
54:
55: public String getInstrumentationName() {
56: return INSTRUMENTED_NAME;
57: }
58:
59: public Object getComponent() {
60: return jmsServerTransport;
61: }
62:
63: public String getUniqueInstrumentationName() {
64: return objectName;
65: }
66:
67: }
|