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

ConnectorPoolMonitorTask

public class ConnectorPoolMonitorTask extends ConnectionPoolTask

Fields Summary
Constructors Summary
public ConnectorPoolMonitorTask(ServerRootMonitor srm, String filter, Timer timer, boolean verbose, File fileName)

        super(srm, filter, timer, verbose, fileName);
        final Map<String,ConnectorConnectionPoolMonitor> connectorMap = srm.getConnectorConnectionPoolMonitorMap();

        if (connectorMap == null)
            throw new MonitorTaskException(localStrings.getString("commands.monitor.unable_to_monitor_connection_pool"));
        
        final String[] keys = MapUtil.getKeyStrings(connectorMap);
        if (this.filter == null)
        {
            checkForNumberOfElements(keys);
            this.filter = keys[0];
        }
        else {
            if (!connectorMap.containsKey(this.filter)) {
                throw new MonitorTaskException(localStrings.getString("commands.monitor.does_not_exist", new Object[] {this.filter}));
            }
        }
        final String connPoolMonitoring = localStrings.getString("commands.monitor.connection_pool_monitoring", new Object[] {this.filter});
        final String title = String.format("%1$50s", connPoolMonitoring);
        CLILogger.getInstance().printMessage(title);
        displayHeader();        
    
Methods Summary
private voidmonitorConnectionPool(java.lang.String element, java.util.Map connectorMap)

        final ConnectorConnectionPoolMonitor connectorPoolMonitor = connectorMap.get(element);
        final ConnectorConnectionPoolStats stats = connectorPoolMonitor.getConnectorConnectionPoolStats();
        displayData(stats);
    
public voidrun()

        if (srm == null) {
            super.cancelMonitorTask();
            return;
        }
        
        final Map<String,ConnectorConnectionPoolMonitor> connectorMap = srm.getConnectorConnectionPoolMonitorMap();
            //maybe lost connection?
        if (connectorMap == null || connectorMap.size()<1) {
            cancelMonitorTask();
            return;
        }
        
        if (verbose && counter == NUM_ROWS)
        {
            displayHeader();
            counter = 0;  //reset to 0
        }
        monitorConnectionPool(filter, connectorMap);
        if (verbose) counter++;