1 23 package com.sun.enterprise.admin.wsmgmt.stats.impl; 24 25 import javax.management.j2ee.statistics.CountStatistic ; 26 import com.sun.appserv.management.j2ee.statistics.StringStatistic; 27 import com.sun.appserv.management.j2ee.statistics.NumberStatistic; 28 29 import com.sun.enterprise.admin.monitor.stats.CountStatisticImpl; 30 import com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl; 31 import com.sun.enterprise.admin.monitor.stats.BoundedRangeStatisticImpl; 32 import com.sun.appserv.management.j2ee.statistics.StringStatisticImpl; 34 import com.sun.appserv.management.j2ee.statistics.NumberStatisticImpl; 35 36 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistry; 37 import com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener; 38 import com.sun.enterprise.admin.monitor.registry.MonitoringLevel; 39 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistrationException; 40 41 import com.sun.enterprise.admin.wsmgmt.stats.spi.WebServiceEndpointStatsProvider; 42 import com.sun.appserv.management.monitor.statistics.WebServiceEndpointAggregateStats; 43 44 import java.util.logging.Logger ; 45 import com.sun.enterprise.log.Log; 46 import com.sun.logging.LogDomains; 47 import com.sun.enterprise.util.i18n.StringManager; 48 49 54 public class WebServiceEndpointStatsImpl 55 extends StatsImpl 56 implements WebServiceEndpointAggregateStats 57 { 58 private WebServiceEndpointStatsProvider delegate; 59 60 private MutableCountStatisticImpl averageResponseTime; 61 private MutableCountStatisticImpl responseTime; 62 private MutableCountStatisticImpl minResponseTime; 63 private MutableCountStatisticImpl maxResponseTime; 64 private MutableCountStatisticImpl totalFaults; 65 private MutableCountStatisticImpl totalSuccesses; 66 private NumberStatisticImpl throughput; 67 private MutableCountStatisticImpl totalAuthFailures; 68 private MutableCountStatisticImpl totalAuthSuccesses; 69 private MutableCountStatisticImpl requestSize; 70 private MutableCountStatisticImpl responseSize; 71 private StringStatisticImpl faultCode; 72 private StringStatisticImpl faultString; 73 private StringStatisticImpl faultActor; 74 private StringStatisticImpl clientHost; 75 private StringStatisticImpl clientUser; 76 private static final StringManager _stringMgr = 77 StringManager.getManager(WebServiceEndpointStatsProvider.class); 78 79 80 public WebServiceEndpointStatsImpl( 81 WebServiceEndpointStatsProvider delegate){ 82 this.delegate = delegate; 83 84 initialize(); 85 } 86 87 protected void initialize() { 88 super.initialize( 89 "com.sun.appserv.management.monitor.statistics.WebServiceEndpointAggregateStats"); 90 91 averageResponseTime = new MutableCountStatisticImpl( 92 new CountStatisticImpl("AverageResponseTime")); 93 minResponseTime = new MutableCountStatisticImpl( 94 new CountStatisticImpl("MinResponseTime")); 95 maxResponseTime = new MutableCountStatisticImpl( 96 new CountStatisticImpl("MaxResponseTime")); 97 responseTime = new MutableCountStatisticImpl( 98 new CountStatisticImpl("ResponseTime")); 99 totalFaults = new MutableCountStatisticImpl( 100 new CountStatisticImpl("TotalFaults")); 101 totalSuccesses = new MutableCountStatisticImpl( 102 new CountStatisticImpl("TotalNumSuccess")); 103 totalAuthFailures = new MutableCountStatisticImpl( 104 new CountStatisticImpl("TotalAuthFailures")); 105 totalAuthSuccesses = new MutableCountStatisticImpl( 106 new CountStatisticImpl("TotalAuthSuccesses")); 107 long t = System.currentTimeMillis(); 108 String description = _stringMgr.getString("throughput.description"); 109 throughput = new NumberStatisticImpl( 110 "Throughput", description, "Requests Per Second", t, t, 111 new Double (0.0)); 112 requestSize = new MutableCountStatisticImpl( 113 new CountStatisticImpl("RequestSize")); 114 responseSize = new MutableCountStatisticImpl( 115 new CountStatisticImpl("ResponseSize")); 116 117 } 118 119 public CountStatistic getAverageResponseTime(){ 120 averageResponseTime.setCount(delegate.getAverageResponseTime()); 121 return (CountStatistic ) averageResponseTime.modifiableView(); 122 } 123 124 public CountStatistic getResponseTime(){ 125 responseTime.setCount(delegate.getResponseTime()); 126 return (CountStatistic ) responseTime.modifiableView(); 127 } 128 129 public CountStatistic getMinResponseTime(){ 130 minResponseTime.setCount(delegate.getMinResponseTime()); 131 return (CountStatistic ) minResponseTime.modifiableView(); 132 } 133 134 public CountStatistic getMaxResponseTime(){ 135 maxResponseTime.setCount(delegate.getMaxResponseTime()); 136 return (CountStatistic ) maxResponseTime.modifiableView(); 137 } 138 139 public CountStatistic getTotalFaults(){ 140 totalFaults.setCount(delegate.getTotalFailures()); 141 return (CountStatistic ) totalFaults.modifiableView(); 142 } 143 144 public CountStatistic getTotalNumSuccess(){ 145 totalSuccesses.setCount(delegate.getTotalSuccesses()); 146 return (CountStatistic ) totalSuccesses.modifiableView(); 147 } 148 149 public CountStatistic getTotalAuthFailures(){ 150 totalAuthFailures.setCount(delegate.getTotalAuthFailures()); 151 return (CountStatistic ) totalAuthFailures.modifiableView(); 152 } 153 154 public CountStatistic getTotalAuthSuccesses() { 155 totalAuthSuccesses.setCount(delegate.getTotalAuthSuccesses()); 156 return (CountStatistic ) totalAuthSuccesses.modifiableView(); 157 } 158 159 public NumberStatistic getThroughput(){ 160 throughput.setNumber(new Double (delegate.getThroughput())); 161 return (NumberStatistic) throughput; 162 } 163 164 } 165 | Popular Tags |