FileDocCategorySizeDatePackage
StatisticWorkaround.javaAPI DocGlassfish v2 API5435Fri May 04 22:24:20 BST 2007com.sun.enterprise.admin.monitor.registry.spi

StatisticWorkaround

public final class StatisticWorkaround extends Object
This class is a workaround for returning the statistic descriptions. Please see bug 5045413. This is a best case effort and in general not expected to be accurate. We should revisit this in AS 8.2.
since
AS 8.1
author
Kedar.Mhaswade@Sun.Com

Fields Summary
private static final StatsDescriptionHelper
helper
private static Logger
logger
Constructors Summary
Methods Summary
private static voidattemptSettingDescription(javax.management.j2ee.statistics.Statistic s, java.lang.String nd)

		if (s instanceof StatisticImpl) {
			((StatisticImpl)s).setDescription(nd);
                        if (logger.isLoggable(Level.FINEST)) {
                            logger.finest("New Description was set: " + nd);
                        }
		}
		else if (s instanceof AverageRangeStatisticImpl) {
			((AverageRangeStatisticImpl)s).setDescription(nd);
                        if (logger.isLoggable(Level.FINEST)) {
                            logger.finest("New Description was set: " + nd);
                        }
		}
		else if (s instanceof MutableBoundedRangeStatisticImpl) {
			((MutableBoundedRangeStatisticImpl)s).setDescription(nd);
                        if (logger.isLoggable(Level.FINEST)) {
                            logger.finest("New Description was set: " + nd);
                        }
		}
		else if (s instanceof MutableCountStatisticImpl) {
			((MutableCountStatisticImpl)s).setDescription(nd);
                        if (logger.isLoggable(Level.FINEST)) {
                            logger.finest("New Description was set: " + nd);
                        }
		}
		else if (s instanceof MutableTimeStatisticImpl) {
			((MutableTimeStatisticImpl)s).setDescription(nd);
                        if (logger.isLoggable(Level.FINEST)) {
                            logger.finest("New Description was set: " + nd);
                        }
		}
	
static final javax.management.j2ee.statistics.Statistic[]populateDescriptions(javax.management.j2ee.statistics.Statistic[] from)

	      
		if (from == null) {
			throw new IllegalArgumentException("null arg");	
		}
		final int length = from.length;
		final Statistic[] to = new Statistic[length];
		for (int i = 0 ; i < length ; i++) {
			final Statistic as = from[i];
			final String name = as.getName();
			final String desc = helper.getDescription(name);
			if (StatsDescriptionHelper.NO_DESCRIPTION_AVAILABLE.equals(desc)) {
				//Localized Description was not available, do nothing
				to[i] = from[i];
			}
			else {
                        	attemptSettingDescription(as, desc);
				to[i] = as;
			}
		}
		return ( to );