1 22 package org.jboss.management.j2ee; 23 24 import org.jboss.logging.Logger; 25 import org.jboss.management.j2ee.statistics.RangeStatisticImpl; 26 import org.jboss.management.j2ee.statistics.StatelessSessionBeanStatsImpl; 27 28 import javax.management.MalformedObjectNameException ; 29 import javax.management.ObjectName ; 30 import javax.management.j2ee.statistics.Stats ; 31 32 39 public class StatelessSessionBean extends SessionBean 40 implements StatelessSessionBeanMBean 41 { 42 43 private static Logger log = Logger.getLogger(StatelessSessionBean.class); 45 private StatelessSessionBeanStatsImpl stats; 46 47 49 51 public StatelessSessionBean(String name, ObjectName ejbModuleName, 52 ObjectName ejbContainerName) 53 throws MalformedObjectNameException , 54 InvalidParentException 55 { 56 this(name, ejbModuleName, ejbContainerName, null, null); 57 } 58 71 public StatelessSessionBean(String name, ObjectName ejbModuleName, 72 ObjectName ejbContainerName, String jndiName, String localJndiName) 73 throws MalformedObjectNameException , 74 InvalidParentException 75 { 76 super(J2EETypeConstants.StatelessSessionBean, name, ejbModuleName, 77 ejbContainerName, jndiName, localJndiName); 78 stats = new StatelessSessionBeanStatsImpl(); 79 } 80 81 public Stats getstats() 83 { 84 try 85 { 86 updateCommonStats(stats); 87 88 ObjectName poolName = getContainerPoolName(); 89 RangeStatisticImpl readyCount = (RangeStatisticImpl) stats.getMethodReadyCount(); 90 Integer poolSize = (Integer ) server.getAttribute(poolName, "CurrentSize"); 91 readyCount.set(poolSize.longValue()); 92 } 93 catch (Exception e) 94 { 95 log.debug("Failed to retrieve stats", e); 96 } 97 return stats; 98 } 99 100 public void resetStats() 101 { 102 stats.reset(); 103 } 104 106 108 public String toString() 109 { 110 return "StatelessSessionBean { " + super.toString() + " } []"; 111 } 112 113 } 114 | Popular Tags |