1 23 24 29 30 package com.sun.enterprise.web; 31 32 import java.util.logging.*; 33 import com.sun.logging.*; 34 import java.util.Hashtable ; 35 import java.util.Enumeration ; 36 import org.apache.catalina.Context; 37 import org.apache.catalina.Container; 38 import org.apache.catalina.Engine; 39 import org.apache.catalina.Manager; 40 import org.apache.catalina.session.PersistentManagerBase; 43 import org.apache.catalina.session.StandardManager; 44 45 49 public class DebugMonitor extends java.util.TimerTask { 50 51 private Hashtable _instances = null; 52 private EmbeddedWebContainer _embedded = null; 53 private static Logger _logger; 54 private WebContainer webContainer = null; 55 static 56 { 57 _logger=LogDomains.getLogger(LogDomains.WEB_LOGGER); 58 } 59 60 61 public DebugMonitor() { 62 } 63 64 65 public DebugMonitor(EmbeddedWebContainer embedded) { 66 _embedded = embedded; 67 } 68 69 public String getApplicationId(Context ctx) { 70 com.sun.enterprise.web.WebModule wm = 71 (com.sun.enterprise.web.WebModule)ctx; 72 return wm.getID(); 73 } 74 75 public String getApplicationName(Context ctx) { 76 return ctx.getName(); 77 } 78 79 public void run() { 80 try { 81 Engine[] engines = _embedded.getEngines(); 82 83 for(int h=0; h<engines.length; h++) { 84 Container engine = (Container) engines[h]; 85 Container[] hosts = engine.findChildren(); 86 for(int i=0; i<hosts.length; i++) { 87 Container nextHost = hosts[i]; 88 Container [] webModules = nextHost.findChildren(); 89 for (int j=0; j<webModules.length; j++) { 90 Container nextWebModule = webModules[j]; 91 Context ctx = (Context)nextWebModule; 92 String webAppName = this.getApplicationName(ctx); 94 Manager nextManager = nextWebModule.getManager(); 95 _logger.finest("webAppName = " + webAppName); 96 97 if(nextManager instanceof StandardManager) { 98 } else { 99 _logger.log(Level.SEVERE, "MONITORING::" + webAppName + ": " + 100 ((PersistentManagerBase)nextManager).getMonitorAttributeValues() ); 101 } 102 103 } 104 } 105 } 106 } catch (Throwable th) { 107 _logger.log(Level.SEVERE, "Exception thrown", th); 108 } 109 110 } 111 112 } 113 | Popular Tags |