1 package org.objectweb.celtix.bus.transports.jms; 2 3 4 import org.objectweb.celtix.bus.management.counters.TransportClientCounters; 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 9 @ManagedResource(componentName = "JMSClientTransport", 10 description = "The Celtix bus JMS Client Transport component ", 11 currencyTimeLimit = 15, persistPolicy = "OnUpdate") 12 public class JMSClientTransportInstrumentation implements Instrumentation { 13 14 private static final String INSTRUMENTATION_NAME = "Bus.Service.Port.JMSClientTransport"; 15 16 private static int instanceNumber; 17 18 JMSClientTransport jmsClientTransport; 19 String objectName; 20 TransportClientCounters counters; 21 22 23 public JMSClientTransportInstrumentation(JMSClientTransport jmsTransport) { 24 jmsClientTransport = jmsTransport; 25 counters = jmsTransport.counters; 26 objectName = "JMSClientTransport" + instanceNumber; 27 instanceNumber++; 28 } 29 30 public static void resetInstanceNumber() { 31 instanceNumber = 0; 32 } 33 34 35 @ManagedAttribute(description = "The JMS client invoke counter", 36 persistPolicy = "OnUpdate") 37 public int getInvoke() { 38 return counters.getInvoke().getValue(); 39 } 40 41 @ManagedAttribute(description = "The JMS client invoke Async counter", 42 persistPolicy = "OnUpdate") 43 public int getInvokeAsync() { 44 return counters.getInvokeAsync().getValue(); 45 } 46 47 @ManagedAttribute(description = "The JMS client one way invoke counter", 48 persistPolicy = "OnUpdate") 49 public int getInvokeOneWay() { 50 return counters.getInvokeOneWay().getValue(); 51 } 52 53 @ManagedAttribute(description = "The JMS client error invoke counter", 54 persistPolicy = "OnUpdate") 55 public int getInvokeError() { 56 return counters.getInvokeError().getValue(); 57 } 58 59 public Object getComponent() { 60 return jmsClientTransport; 61 } 62 63 public String getInstrumentationName() { 64 return INSTRUMENTATION_NAME; 65 } 66 67 public String getUniqueInstrumentationName() { 68 return objectName; 69 } 70 } 71 | Popular Tags |