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

ConnectionQueueMonitorTask

public class ConnectionQueueMonitorTask extends MonitorTask

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


             
                                           
         
    
        super(srm, filter, timer, verbose, fileName);
        final String connQueueMonitoring = localStrings.getString("commands.monitor.connection_queue_monitoring_title");
        final String title = String.format("%1$42s", connQueueMonitoring);
        CLILogger.getInstance().printMessage(title);
        displayHeader();
    
Methods Summary
private voiddisplayData(ConnectionQueueStats cqs)

        final String data = String.format(displayFormat,
                                          cqs.getCountOverflows().getCount(),
                                          cqs.getCountQueued().getCount(),
                                          cqs.getCountQueued15MinuteAverage().getCount(),
                                          cqs.getCountQueued1MinuteAverage().getCount(),
                                          cqs.getCountQueued5MinuteAverage().getCount(),
                                          cqs.getCountTotalConnections().getCount(),
                                          cqs.getCountTotalQueued().getCount(),
                                          cqs.getID().getCurrent(),
                                          cqs.getMaxQueued().getCount(),
                                          cqs.getPeakQueued().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,"+
                                              "%8$s,%9$s,%10$s",
                                              cqs.getCountOverflows().getCount(),
                                              cqs.getCountQueued().getCount(),
                                              cqs.getCountQueued15MinuteAverage().getCount(),
                                              cqs.getCountQueued1MinuteAverage().getCount(),
                                              cqs.getCountQueued5MinuteAverage().getCount(),
                                              cqs.getCountTotalConnections().getCount(),
                                              cqs.getCountTotalQueued().getCount(),
                                              cqs.getID().getCurrent(),
                                              cqs.getMaxQueued().getCount(),
                                              cqs.getPeakQueued().getCount());
            writeToFile(fileData);
        }
    
public voiddisplayDetails()

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

        final String of = localStrings.getString("commands.monitor.of");
        final String que = localStrings.getString("commands.monitor.que");
        final String fifteen_a = localStrings.getString("commands.monitor.15a");
        final String one_a = localStrings.getString("commands.monitor.1a");
        final String five_a = localStrings.getString("commands.monitor.5a");
        final String tcon = localStrings.getString("commands.monitor.tcon");
        final String tque = localStrings.getString("commands.monitor.tque");
        final String id = localStrings.getString("commands.monitor.id");
        final String mque = localStrings.getString("commands.monitor.mque");
        final String pque = localStrings.getString("commands.monitor.pque");        
        
        final String header = String.format(displayFormat,
                                            of,que,fifteen_a,one_a,five_a,tcon,tque,id,
                                            mque,pque);
        
        CLILogger.getInstance().printMessage(header);
        if (fileName != null)
        {
            writeToFile(localStrings.getString("commands.monitor.connection_queue_write_to_file"));
        }
    
public voidrun()

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

        final HTTPServiceMonitor httpserviceMonitor = srm.getHTTPServiceMonitor();
        if (httpserviceMonitor == null) {
            cancelMonitorTask();
            return;
        }
        
            
        final ConnectionQueueMonitor connectionQueueMonitor = httpserviceMonitor.getConnectionQueueMonitor();
        if (connectionQueueMonitor == null) {
            cancelMonitorTask();
            return;
        }
        
        final ConnectionQueueStats connectionQueueStats = connectionQueueMonitor.getConnectionQueueStats();
        
        if (verbose && counter == NUM_ROWS)
        {
            displayHeader();
            counter = 0;  //reset to 0
        }
        displayData(connectionQueueStats);
        if (verbose) counter++;