1 package org.objectweb.celtix.bus.transports.http; 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 = "HTTPServerTransport", 11 description = "The Celtix bus HTTP Server Transport component ", 12 currencyTimeLimit = 15, persistPolicy = "OnUpdate") 13 public class HTTPServerTransportInstrumentation 14 extends TransportInstrumentation 15 implements Instrumentation { 16 private static final String INSTRUMENTED_NAME = "Bus.Service.Port.HTTPServerTransport"; 17 18 JettyHTTPServerTransport httpServerTransport; 19 HTTPServerPolicy policy; 20 TransportServerCounters counters; 21 22 24 public HTTPServerTransportInstrumentation(JettyHTTPServerTransport hsTransport) { 25 super(hsTransport.bus); 26 httpServerTransport = hsTransport; 27 serviceName = findServiceName(httpServerTransport.reference); 29 portName = findPortName(httpServerTransport.reference); 30 34 objectName = getPortObjectName() + ",name=HTTPServerTransport"; 35 counters = hsTransport.counters; 36 } 37 38 39 @ManagedAttribute(description = "Get the Service name", 40 persistPolicy = "OnUpdate") 41 public String getServiceName() { 42 return serviceName; 43 } 44 45 @ManagedAttribute(description = "Get the port name", 46 persistPolicy = "OnUpdate") 47 public String getPortName() { 48 return portName; 49 } 50 51 @ManagedAttribute(description = "The http server url", 52 persistPolicy = "OnUpdate") 53 public String getUrl() { 55 return httpServerTransport.url; 56 } 57 58 @ManagedAttribute(description = "The http server request error", 59 persistPolicy = "OnUpdate") 60 public int getTotalError() { 61 return counters.getTotalError().getValue(); 62 } 63 64 @ManagedAttribute(description = "The http server total request counter", 65 persistPolicy = "OnUpdate") 66 public int getRequestTotal() { 67 return counters.getRequestTotal().getValue(); 68 } 69 70 @ManagedAttribute(description = "The http server one way request counter", 71 persistPolicy = "OnUpdate") 72 public int getRequestOneWay() { 73 return counters.getRequestOneWay().getValue(); 74 } 75 76 public HTTPServerPolicy getHTTPServerPolicy() { 78 return httpServerTransport.policy; 79 } 80 81 public Object getComponent() { 82 return httpServerTransport; 83 } 84 85 public String getInstrumentationName() { 86 return INSTRUMENTED_NAME; 87 } 88 89 public String getUniqueInstrumentationName() { 90 return objectName; 91 } 92 93 94 } 95 | Popular Tags |