FileDocCategorySizeDatePackage
DebugMonitor.javaAPI DocGlassfish v2 API4973Fri May 04 22:36:02 BST 2007com.sun.enterprise.web

DebugMonitor

public final class DebugMonitor extends TimerTask
author
Administrator

Fields Summary
private Hashtable
_instances
private final EmbeddedWebContainer
_embedded
private static final Logger
_logger
private WebContainer
webContainer
Constructors Summary
public DebugMonitor()
Creates a new instance of DebugMonitor

    
    
            _logger=LogDomains.getLogger(LogDomains.WEB_LOGGER);
    
        _embedded   = null;
    
public DebugMonitor(EmbeddedWebContainer embedded)
Creates a new instance of DebugMonitor

        _embedded = embedded;
    
Methods Summary
public java.lang.StringgetApplicationId(org.apache.catalina.Context ctx)

        com.sun.enterprise.web.WebModule wm = 
            (com.sun.enterprise.web.WebModule)ctx;
        return wm.getID();
    
public java.lang.StringgetApplicationName(org.apache.catalina.Context ctx)

        return ctx.getName();
    
public voidrun()

        try {
            Engine[] engines = _embedded.getEngines();
            
            for(int h=0; h<engines.length; h++) {
                Container engine = (Container) engines[h];
                Container[] hosts = engine.findChildren();
                for(int i=0; i<hosts.length; i++) {
                    Container nextHost = hosts[i];
                    Container [] webModules = nextHost.findChildren();
                    for (int j=0; j<webModules.length; j++) {
                        Container nextWebModule = webModules[j];
                        Context ctx = (Context)nextWebModule;
                        //this code gets managers
                        String webAppName = this.getApplicationName(ctx);
                        Manager nextManager = nextWebModule.getManager();
                        _logger.finest("webAppName = " + webAppName);
                        
                        if(nextManager instanceof StandardManager) {
                        } else {
                            _logger.log(Level.SEVERE, "MONITORING::" + webAppName + ": " +
                                       ((PersistentManagerBase)nextManager).getMonitorAttributeValues() );        
                        }                        
                        
                    }                    
                }                 
            }
        } catch (Throwable th) {
            _logger.log(Level.SEVERE, "Exception thrown", th);
        }