1 package org.objectweb.celtix.bus.transports.http; 2 3 4 5 import org.objectweb.celtix.bus.configuration.security.AuthorizationPolicy; 6 import org.objectweb.celtix.bus.management.counters.TransportClientCounters; 7 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedAttribute; 8 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedResource; 9 import org.objectweb.celtix.management.Instrumentation; 10 import org.objectweb.celtix.transports.http.configuration.HTTPClientPolicy; 11 12 @ManagedResource(componentName = "HTTPClientTransport", 13 description = "The Celtix bus HTTP client side transport componnet ", 14 currencyTimeLimit = 15, persistPolicy = "OnUpdate") 15 public class HTTPClientTransportInstrumentation implements Instrumentation { 16 private static final String INSTRUMENTATION_NAME = "Bus.Service.Port.HTTPClientTransport"; 17 18 private static int instanceNumber; 19 20 HTTPClientTransport httpClientTransport; 21 String objectName; 22 TransportClientCounters counters; 23 24 25 public HTTPClientTransportInstrumentation(HTTPClientTransport hcTransport) { 26 httpClientTransport = hcTransport; 27 counters = hcTransport.counters; 28 objectName = "HTTPClientTransport" + instanceNumber; 29 instanceNumber++; 30 } 31 32 public static void resetInstanceNumber() { 33 instanceNumber = 0; 34 } 35 36 37 public HTTPClientPolicy getHTTPClientPolicy() { 38 return httpClientTransport.policy; 39 } 40 41 public AuthorizationPolicy getAuthPolicy() { 42 return httpClientTransport.authPolicy; 43 } 44 45 public AuthorizationPolicy getProxyAuthPolicy() { 46 return httpClientTransport.proxyAuthPolicy; 47 } 48 49 @ManagedAttribute(description = "The http request url", 50 persistPolicy = "OnUpdate") 51 public String getUrl() { 52 return httpClientTransport.url.toString(); 53 } 54 55 @ManagedAttribute(description = "The http client invoke counter", 56 persistPolicy = "OnUpdate") 57 public int getInvoke() { 58 return counters.getInvoke().getValue(); 59 } 60 61 @ManagedAttribute(description = "The http client invoke Async counter", 62 persistPolicy = "OnUpdate") 63 public int getInvokeAsync() { 64 return counters.getInvokeAsync().getValue(); 65 } 66 67 @ManagedAttribute(description = "The http client one way invoke counter", 68 persistPolicy = "OnUpdate") 69 public int getInvokeOneWay() { 70 return counters.getInvokeOneWay().getValue(); 71 } 72 73 @ManagedAttribute(description = "The http client error invoke counter", 74 persistPolicy = "OnUpdate") 75 public int getInvokeError() { 76 return counters.getInvokeError().getValue(); 77 } 78 79 public Object getComponent() { 80 return httpClientTransport; 81 } 82 83 public String getInstrumentationName() { 84 return INSTRUMENTATION_NAME; 85 } 86 87 public String getUniqueInstrumentationName() { 88 return objectName; 89 } 90 } 91 | Popular Tags |