FileDocCategorySizeDatePackage
CustomMonitoringStatsImplBase.javaAPI DocGlassfish v2 API5329Fri May 04 22:23:40 BST 2007com.sun.enterprise.management.monitor.stats

CustomMonitoringStatsImplBase

public abstract class CustomMonitoringStatsImplBase extends MonitoringStatsImplBase
Base implementation class for LB Monitoring MBeans that provide Stats.

Fields Summary
Constructors Summary
public CustomMonitoringStatsImplBase(String j2eeType)

        super(j2eeType);
    
Methods Summary
protected javax.management.j2ee.statistics.Statistic[]getStatisticsFromImpl(CustomStatsImpl customStatsImpl)
Get all Statistics from the delegate (our only available call API). Statistic names are translated appropriately.

        try {
            final Statistic[] statistics = getStatisticsFromImplRaw(customStatsImpl);
            // translate the names to be the ones we expose in MBeanInfo
            for(int i = 0; i < statistics.length; ++i) {
                final Statistic	origStatistic	= statistics[i];

                final MapStatistic	m	= new MapStatisticImpl(origStatistic);

                final String	convertedName	= originalToDerivedStatisticName(origStatistic.getName());
                if (! convertedName.equals(origStatistic.getName())) 
                        m.setName(convertedName);

                final Class<? extends Statistic> theClass =
                    StatisticFactory.getInterface(origStatistic);
                assert(theClass != null);

                // this will create one which implements the requisite interfaces
                statistics[ i ]	= StatisticFactory.create(theClass, m.asMap());

                assert(theClass.isAssignableFrom(statistics[ i ].getClass()));
            }
            return(statistics);
        } catch (Exception e) {
            final Throwable rootCause = ExceptionUtil.getRootCause(e);

            if (!(rootCause instanceof InstanceNotFoundException)) 
                    // don't rethrow--will make MBeanServer unuseable as it has a bug if we throw
                    // an exception of of getMBeanInfo() which halts any further processing of the query
                    //NOTE: WARNING_CHANGED_TO_FINE	
                    logWarning("Can't get Statistics from impl of " + getObjectName() +
                            "\n" + rootCause.getMessage() + "\n" + ExceptionUtil.getStackTrace(rootCause));
            throw new RuntimeException(e);
        }
    
protected javax.management.j2ee.statistics.Statistic[]getStatisticsFromImplRaw(CustomStatsImpl impl)

	try {
            final Statistic[] statistics = impl.getStatistics();
            return statistics;
	} catch (Exception e) {
            final Throwable rootCause   = ExceptionUtil.getRootCause( e );
            logWarning( "CustomMonitoringStatsImplBase: " +
                "the stats impl for the stats of AMX MBean " +
                getObjectName() + " threw an exception: " + rootCause +
                ", stack = \n" + ExceptionUtil.getStackTrace( rootCause ) );
        }
        return new Statistic[0];