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