1 22 package org.jboss.management.j2ee; 23 24 import org.jboss.logging.Logger; 25 import org.jboss.management.j2ee.statistics.CountStatisticImpl; 26 import org.jboss.management.j2ee.statistics.MessageDrivenBeanStatsImpl; 27 28 import javax.management.MalformedObjectNameException ; 29 import javax.management.ObjectName ; 30 import javax.management.j2ee.statistics.Stats ; 31 32 39 public class MessageDrivenBean extends EJB 40 implements MessageDrivenBeanMBean 41 { 42 43 private static Logger log = Logger.getLogger(MessageDrivenBean.class); 45 46 private MessageDrivenBeanStatsImpl stats; 47 48 50 52 public MessageDrivenBean(String name, ObjectName ejbModuleName, 53 ObjectName ejbContainerName) 54 throws MalformedObjectNameException , 55 InvalidParentException 56 { 57 this(name, ejbModuleName, ejbContainerName, null); 58 } 59 70 public MessageDrivenBean(String name, ObjectName ejbModuleName, 71 ObjectName ejbContainerName, String localJndiName) 72 throws MalformedObjectNameException , 73 InvalidParentException 74 { 75 super(J2EETypeConstants.MessageDrivenBean, name, ejbModuleName, 76 ejbContainerName, null, localJndiName); 77 stats = new MessageDrivenBeanStatsImpl(); 78 } 79 80 public Stats getstats() 82 { 83 try 84 { 85 updateCommonStats(stats); 86 87 ObjectName containerName = getContainerName(); 88 CountStatisticImpl msgCount = (CountStatisticImpl) stats.getMessageCount(); 89 Long count = (Long ) server.getAttribute(containerName, "MessageCount"); 90 msgCount.set(count.longValue()); 91 } 92 catch (Exception e) 93 { 94 log.debug("Failed to retrieve stats", e); 95 } 96 return stats; 97 } 98 99 public void resetStats() 100 { 101 stats.reset(); 102 } 103 105 107 public String toString() 108 { 109 return "MessageDrivenBean[ " + super.toString() + " ]"; 110 } 111 } 112 | Popular Tags |