1 23 24 29 30 package com.sun.enterprise.web; 31 32 import java.util.logging.*; 33 import com.sun.logging.*; 34 import org.apache.catalina.Context; 35 import org.apache.catalina.Container; 36 import org.apache.catalina.Engine; 37 import com.sun.enterprise.server.ServerContext; 38 import com.sun.enterprise.admin.monitor.stats.WebModuleStats; 39 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistry; 40 41 45 public class MonitorUtil { 46 47 private static Logger _logger; 48 49 static { 50 _logger = LogDomains.getLogger(LogDomains.WEB_LOGGER); 51 } 52 53 56 public static void resetMonitorStats(EmbeddedWebContainer embedded, 57 ServerContext serverContext) { 58 59 MonitoringRegistry monitoringRegistry = 60 serverContext.getMonitoringRegistry(); 61 62 Engine[] engines = embedded.getEngines(); 63 for(int h=0; h<engines.length; h++) { 64 Container engine = (Container) engines[h]; 65 Container[] hosts = engine.findChildren(); 66 for(int i=0; i<hosts.length; i++) { 67 Container nextHost = hosts[i]; 68 Container [] webModules = nextHost.findChildren(); 69 for (int j=0; j<webModules.length; j++) { 70 WebModule webModule = (WebModule) webModules[j]; 71 if (!webModule.hasWebXml()) { 72 continue; 74 } 75 79 String j2eeApp = webModule.getJ2EEApplication(); 80 if ("null".equalsIgnoreCase(j2eeApp)) { 81 j2eeApp = null; 82 } 83 WebModuleStats stats = 84 monitoringRegistry.getWebModuleStats( 85 j2eeApp, 86 webModule.getModuleName(), 87 webModule.getPath(), 88 nextHost.getName()); 89 if (stats != null) { 90 try { 91 stats.reset(); 92 } catch (Throwable th) { 93 _logger.log(Level.SEVERE, 94 "Error resetting WebModuleStats", th); 95 } 96 } 97 } 98 } 99 } 100 } 101 102 } 103 | Popular Tags |