Package com.sun.messaging.jmq.io

Examples of com.sun.messaging.jmq.io.MetricCounters


    public long     timestamp;

    public int      nConnections;

    public MetricData() {
        totals = new MetricCounters();
        rates  = new MetricCounters();
        reset();
    }
View Full Code Here


    public static boolean isEnabled() {
        return Globals.getConfig().getBooleanProperty(ENABLED_PROPERTY);
    }

    public MetricManager() {
        lastSample = new MetricCounters();
    }
View Full Code Here

    /**
     * Used by connections that are going away to deposit their
     * totals, so they won't be lost.
     */
    public synchronized void depositTotals(String service, MetricCounters counters) {
  MetricCounters mc = (MetricCounters)deadTotalsByService.get(service);
  if (mc == null) {
      mc = new MetricCounters();
      deadTotalsByService.put(service, mc);
  }
        mc.update(counters);
    }
View Full Code Here

        mc.update(counters);
    }

    public synchronized void reset() {
        deadTotalsByService.clear();
        lastSample = new MetricCounters();
    }
View Full Code Here

     */
    public synchronized MetricCounters getMetricCounters(String serviceName) {

        ConnectionManager cm = Globals.getConnectionManager();

        MetricCounters totals = new MetricCounters();

        // Add counters for connections that no longer exist
        if (serviceName == null) {
            // Sum values for all services
            Enumeration e;
            for (e = deadTotalsByService.elements(); e.hasMoreElements(); ) {
                totals.update((MetricCounters)e.nextElement());
            }
        } else {
            // Sum values for just the specified service
      MetricCounters deadTotals =
                    (MetricCounters)deadTotalsByService.get(serviceName);
      if (deadTotals != null) {
                totals.update(
                    (MetricCounters)deadTotalsByService.get(serviceName));
            }
View Full Code Here

        long currentTime = System.currentTimeMillis();
        // long elapsedSecs = (currentTime - lastSampleTime) / 1000;
        float elapsedSecs = (currentTime - lastSampleTime) / (float)1000;

        MetricCounters totals = getMetricCounters(null);

        // Copy values into MetricData
        md.timestamp = currentTime;
        md.totalMemory = rt.totalMemory();
        md.freeMemory  = rt.freeMemory();
View Full Code Here

            Globals.stdOutPrintln(ar.getString(ar.I_JMQCMD_SPECIFY_BKR));
            printBrokerInfo(broker);

            try  {
    MetricCounters  previousMetrics = null;
    int  rowsPrinted = 0;

                connectToBroker(broker);

    while (true)  {
                    broker.sendGetMetricsMessage(svcName);
                    MetricCounters mc = (MetricCounters)broker.receiveGetMetricsReplyMessage();

                    if (mc == null) {
                        Globals.stdErrPrintln(ar.getString(ar.I_JMQCMD_METRICS_SVC_FAIL));
                        return (1);
        }

        addOneMetricRow(metricType, bcp, mc, previousMetrics);
   
        if ((rowsPrinted % 20) == 0)  {
            bcp.print();
        } else  {
            bcp.print(false);
        }

        bcp.clear();
        previousMetrics = mc;
        rowsPrinted++;

        if (metricSamples > 0)  {
      if (metricSamples == rowsPrinted)  {
          break;
      }
        }

        try  {
            Thread.sleep(sleepTime * 1000);
                    } catch (InterruptedException ie)  {
            Globals.stdErrPrintln(ie.toString());
        }
    }

                Globals.stdOutPrintln("");
          Globals.stdOutPrintln(ar.getString(ar.I_JMQCMD_METRICS_SVC_SUC));

            } catch (BrokerAdminException bae)  {
                handleBrokerAdminException(bae);

    Globals.stdErrPrintln(ar.getString(ar.I_JMQCMD_METRICS_SVC_FAIL));
                return (1);
            }
        } else if (CMDARG_BROKER.equals(commandArg)) {
            if (broker == null)  {
                Globals.stdErrPrintln(ar.getString(ar.I_JMQCMD_METRICS_BKR_FAIL));
                return (1);
            }

      bcp = setupMetricTitle(commandArg, metricType);

            boolean force = brokerCmdProps.forceModeSet();
            if (!force)
                broker = promptForAuthentication(broker);

            Globals.stdOutPrintln(ar.getString(ar.I_JMQCMD_METRICS_BKR));
            printBrokerInfo(broker);

            try  {
    MetricCounters  previousMetrics = null;
    int  rowsPrinted = 0;

                connectToBroker(broker);

    while (true)  {
                    broker.sendGetMetricsMessage(null);
                    MetricCounters mc = (MetricCounters)broker.receiveGetMetricsReplyMessage();


                    if (mc == null) {
                        Globals.stdErrPrintln(ar.getString(ar.I_JMQCMD_METRICS_BKR_FAIL));
                        return (1);
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.io.MetricCounters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.