Package javax.management.j2ee.statistics

Examples of javax.management.j2ee.statistics.Stats


  }
 
    public void
  checkGetOpenStatistic( final MonitoringStats mon )
  {
    final Stats  stats  = mon.getStats();
   
    final String[]  names  = mon.getStatisticNames();
    for( int i = 0; i < names.length; ++i )
    {
      final String  name  = names[ i ];
View Full Code Here


    final Method  specificStatsMethod  = getSpecificStatsGetterMethod( mon );


    // the type of Stats returned from getStats() should be the same as the type
    // returned from the (only) specific getAbcStats()
    final Stats  plainStats  = mon.getStats();
    assert( specificStatsMethod.getReturnType().isAssignableFrom( plainStats.getClass() ) ) :
      "Stats returned from " + objectName + " getStats() should be assignable to " +
        specificStatsMethod.getReturnType().getName();
    checkStats( mon, plainStats );
   
    Stats  stats  = null;
    try
    {
      // verify that we can get it
      stats  = (Stats)specificStatsMethod.invoke( mon, (Object[])null );
    }
    catch( Exception e )
    {
      final Throwable rootCause  = ExceptionUtil.getRootCause( e );
     
      failure(
        "Failure calling " + specificStatsMethod.getName() + "() on " + objectName + " = " +
        rootCause.getClass().getName() );
    }
     
    assert( plainStats.getClass() == stats.getClass() );
    checkStats( mon, stats );
  }
View Full Code Here

      try
      {
    final MonitoringStats  mon  = getProxyFactory().getProxy( objectName, MonitoringStats.class);
   
    final Method  m  = getSpecificStatsGetterMethod( mon );
    final Stats    stats  = (Stats)m.invoke( mon, (Object[])null );
    final Method[]  methodsViaIntrospection  = J2EEUtil.getStatisticGetterMethodsUsingIntrospection( stats );
    final Method[]  methodsViaNames  = J2EEUtil.getStatisticGetterMethodsUsingNames( stats );
   
    assert GSetUtil.newSet( methodsViaNames ).equals( GSetUtil.newSet( methodsViaIntrospection ) ) :
      "Statistic names for " + quote( objectName ) +
        " obtained via Statistic names do not match those obtained via introspection: \n" +
        "via names:" + toString( methodsToNames(methodsViaNames) ) +
        "\nvia introspection: " + toString( methodsToNames(methodsViaIntrospection) );
       
    final String[]  namesFromMethods  = methodsToNames( methodsViaNames );
   
    assert GSetUtil.newSet( namesFromMethods ).equals( GSetUtil.newSet( stats.getStatisticNames() ) ) :
      "MBean " + quote( objectName ) + " Stats object of class " + stats.getClass().getName() +
        " has Statistic methods that don't match getStatisticNames() =>\n" +
        toString( namesFromMethods ) + " != " +
            toString( stats.getStatisticNames() );
      }
      catch( Exception e )
      {
          trace( "Caught exception for " + StringUtil.quote(JMXUtil.toString(objectName)) +
              " = " +  e.getClass().getName() + ": " + StringUtil.quote(e.getMessage()) + "\n" +
View Full Code Here

                registerEndpointStatsProvider(endpoint, prov);

            MonitoringLevelListener listener = new
            WSMonitoringLevelListener(name, moduleName, ctxRoot, isStandAlone,
                vs, j2eeAppName, isEjbModule);
            Stats stats = new WebServiceEndpointStatsImpl(prov);

            String appName = null;
            if ( isStandAlone == true) {
                appName = null;
            } else {
View Full Code Here

  }
 
    protected Stats
  getStatsGeneric()
  {
    Stats  stats  = null;
   
    if ( isstatisticProvider() )
    {
      final ObjectName  mon  = getMonitoringPeerObjectName();
      if ( mon != null )
View Full Code Here

  {
    boolean  equals  = false;
   
    if ( rhs != null && rhs instanceof Stats )
    {
      final Stats  stats  = (Stats)rhs;
     
      final String[]  myNames  = getStatisticNames();
      final String[]  rhsNames  = stats.getStatisticNames();
      if ( myNames.length == rhsNames.length )
      {
        equals  = true;
       
        for( int i = 0; i < myNames.length; ++i )
        {
          final String  statisticName  = myNames[ i ];
          final Statistic  myStatistic    = getStatistic( statisticName );
          final Statistic  rhsStatistic  = stats.getStatistic( statisticName );
         
          if ( ! myStatistic.equals( rhsStatistic ) )
          {
            equals  = false;
            break;
View Full Code Here

     * @return HashMap
     * @throws Exception
     */
    public static HashMap getStats(String objectName) throws Exception {
        HashMap statsMap = new HashMap();
        Stats stats = (Stats)mbServer.getAttribute(new ObjectName(objectName), "stats");
        String[] sttsName = stats.getStatisticNames();
        Statistic[] stts = stats.getStatistics();
        for(int i = 0; i < sttsName.length; i++) {
            Statistic aStat = stats.getStatistic(sttsName[i]);
            if(aStat instanceof RangeStatistic) {
                Long current = new Long(((RangeStatistic)aStat).getCurrent());
                Long high = new Long(((RangeStatistic)aStat).getHighWaterMark());
                Long low = new Long(((RangeStatistic)aStat).getLowWaterMark());
                statsMap.put(stts[i].getName() + " Current", current);
View Full Code Here

        // for each mbean name
        for(Iterator<String> it = mbeans.iterator(); it.hasNext(); ) {
            ArrayList<String> mbeanStatsList = new ArrayList<String>();
            String mbeanName = it.next();
            try {
                Stats stats = (Stats)mbServer.getAttribute(new ObjectName(mbeanName), "stats");
                String[] sttsName = stats.getStatisticNames();
                Statistic[] stts = stats.getStatistics();
                for(int i = 0; i < sttsName.length; i++) {
                    Statistic aStat = stats.getStatistic(sttsName[i]);
                    if(aStat instanceof RangeStatistic) {
                        mbeanStatsList.add(stts[i].getName() + " Current");
                        mbeanStatsList.add(stts[i].getName() + " Max");
                        mbeanStatsList.add(stts[i].getName() + " Min");
                    } else if(aStat instanceof CountStatistic) {
View Full Code Here

                    .openConnection();
            assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            assertEquals("Hello World", reader.readLine());
           
            Stats stats = component.getStats();
            Statistic[] stts = stats.getStatistics();
            Statistic aStts;
            String[] sttsNames = stats.getStatisticNames();
            for (int i = 0; i < sttsNames.length; i++) {
                // check that the names match the getter methods
                String sttsName = sttsNames[i];
                assertFalse(sttsName.equals(stts[i].getName()));
                try {
                stats.getClass().getMethod("get" + sttsName, new Class[0]);
                } catch (NoSuchMethodException e) {
              continue; // ignore this statistics for now, JSR77.6.10.1.1
                }
                aStts = stats.getStatistic(sttsName);
                assertTrue("startTime was not set for " + sttsName, aStts.getStartTime() != 0);
                assertTrue("lastSampleTime was not set for " + sttsName, aStts.getLastSampleTime() != 0);
                /*System.out.println("              lastSampleTime = " + aStts.getLastSampleTime() +
                  "  startTime = " + aStts.getStartTime());
                System.out.println(aStts);*/
 
View Full Code Here

                connector.resetStats();
                webModule.resetStats();
            }
            //System.out.println("******* NOW IS " + System.currentTimeMillis());
            Stats[] allStats = { webModule.getStats(), connector.getStats() };
            Stats stats;
            for (int j = 0; j < allStats.length; j++) {
                stats = allStats[j];
                Statistic[] stts = stats.getStatistics();
                Statistic aStts;
                String[] sttsNames = stats.getStatisticNames();
                for (int i = 0; i < sttsNames.length; i++) {
                    assertFalse(sttsNames[i].equals(stts[i].getName()));
                    aStts = stats.getStatistic(sttsNames[i]);
                    assertTrue("startTime was not set", aStts.getStartTime() != 0);
                    assertTrue("lastSampleTime was not set", aStts.getLastSampleTime() != 0);
                    //System.out.println("lastSampleTime = " + aStts.getLastSampleTime() + "  startTime = " + aStts.getStartTime());
                    //System.out.println(aStts);
                }
View Full Code Here

TOP

Related Classes of javax.management.j2ee.statistics.Stats

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.