FileDocCategorySizeDatePackage
KeepAliveMonitorTask.javaAPI DocGlassfish v2 API6539Fri May 04 22:25:18 BST 2007com.sun.enterprise.cli.commands.monitor

KeepAliveMonitorTask

public class KeepAliveMonitorTask extends MonitorTask

Fields Summary
private final String
displayFormat
Constructors Summary
public KeepAliveMonitorTask(ServerRootMonitor srm, String filter, Timer timer, boolean verbose, File fileName)


             
                                     
         
    
        super(srm, filter, timer, verbose, fileName);
        final String keepAliveTitle=localStrings.getString("commands.monitor.keep_alive_monitoring");
        final String title = String.format("%1$40s", keepAliveTitle);
        CLILogger.getInstance().printMessage(title);
        displayHeader();        
    
Methods Summary
private voiddisplayData(KeepAliveStats kas)

        final String data = String.format(displayFormat,
                                          kas.getCountConnections().getCount(),
                                          kas.getCountFlushes().getCount(),
                                          kas.getCountHits().getCount(),
                                          kas.getCountRefusals().getCount(),
                                          kas.getCountTimeouts().getCount(),
                                          kas.getMaxConnections().getCount(),
                                          kas.getSecondsTimeouts().getCount());
        CLILogger.getInstance().printMessage(data);
        if (fileName != null)
        {
            final String fileData = String.format("%1$s,%2$s,%3$s,%4$s,%5$s,%6$s,%7$s",
                                                  kas.getCountConnections().getCount(),
                                                  kas.getCountFlushes().getCount(),
                                                  kas.getCountHits().getCount(),
                                                  kas.getCountRefusals().getCount(),
                                                  kas.getCountTimeouts().getCount(),
                                                  kas.getMaxConnections().getCount(),
                                                  kas.getSecondsTimeouts().getCount());
            writeToFile(fileData);
        }
    
public voiddisplayDetails()

        final String details = localStrings.getString("commands.monitor.keep_alive_detail");
        CLILogger.getInstance().printMessage(details);
    
private voiddisplayHeader()

        final String cc = localStrings.getString("commands.monitor.cc");
        final String cf = localStrings.getString("commands.monitor.cf");
        final String ch = localStrings.getString("commands.monitor.ch");
        final String cr = localStrings.getString("commands.monitor.cr");
        final String cto = localStrings.getString("commands.monitor.cto");
        final String mc = localStrings.getString("commands.monitor.mc");
        final String sto = localStrings.getString("commands.monitor.sto");
        
        final String header = String.format(displayFormat, cc,cf,ch,cr,cto,mc,sto);
        CLILogger.getInstance().printMessage(header);
        if (fileName != null)
        {
            writeToFile(localStrings.getString("commands.monitor.keep_alive_write_to_file"));
        }
    
public voidrun()

        if (srm == null) {
            super.cancelMonitorTask();
            return;
        }
        

        final HTTPServiceMonitor httpserviceMonitor = srm.getHTTPServiceMonitor();
        if (httpserviceMonitor == null) {
            cancelMonitorTask();
            return;
        }
        

        final KeepAliveMonitor keepAliveMonitor = httpserviceMonitor.getKeepAliveMonitor();
        if (keepAliveMonitor == null) {
            cancelMonitorTask();
            return;
        }
        
        final KeepAliveStats keepAliveStats = keepAliveMonitor.getKeepAliveStats();

        if (verbose && counter == NUM_ROWS)
        {
            displayHeader();
            counter = 0;  //reset to 0
        }
        displayData(keepAliveStats);
        if (verbose) counter++;