1 22 package org.jboss.management.j2ee.statistics; 23 24 import org.jboss.management.j2ee.StatisticsConstants; 25 26 import javax.management.j2ee.statistics.JCAConnectionStats ; 27 import javax.management.j2ee.statistics.TimeStatistic ; 28 29 33 public class JCAConnectionStatsImpl extends StatsBase 34 implements JCAConnectionStats 35 { 36 38 39 private static final long serialVersionUID = -5409299496765142153L; 40 41 43 private String cfName; 44 private String mcfName; 45 46 48 public JCAConnectionStatsImpl(String cfName, String mcfName) 49 { 50 this(cfName, mcfName, null, null); 51 } 52 53 public JCAConnectionStatsImpl(String cfName, String mcfName, 54 TimeStatistic waitTime, TimeStatistic useTime) 55 { 56 if (waitTime == null) 57 { 58 waitTime = new TimeStatisticImpl("WaitTime", StatisticsConstants.MILLISECOND, 59 "Time spent waiting for a connection to be available"); 60 } 61 if (useTime == null) 62 { 63 useTime = new TimeStatisticImpl("UseTime", StatisticsConstants.MILLISECOND, 64 "Time spent using the connection"); 65 } 66 super.addStatistic("WaitTime", waitTime); 67 super.addStatistic("UseTime", useTime); 68 this.cfName = cfName; 69 this.mcfName = mcfName; 70 } 71 72 public String getConnectionFactory() 73 { 74 return cfName; 75 } 76 77 public String getManagedConnectionFactory() 78 { 79 return mcfName; 80 } 81 82 public TimeStatistic getWaitTime() 83 { 84 TimeStatistic ts = (TimeStatistic ) getStatistic("WaitTime"); 85 return ts; 86 } 87 88 public TimeStatistic getUseTime() 89 { 90 TimeStatistic ts = (TimeStatistic ) getStatistic("UseTime"); 91 return ts; 92 } 93 } 94 | Popular Tags |