Sun GlassFish Enterprise Server v3 Prelude Add-On Component Development Guide

Creating Objects to Represent a Component's Statistics

Create one object to represent each statistic that you are adding to the monitorable object tree. Create the objects in your listener class or in the class that represents your add-on component. Each object must be an implementation of an interface that extends org.glassfish.flashlight.datatree.TreeNode.


Note –

The TreeNode is an unstable interface and is subject to change.


To specify the name of the node in the monitorable object tree that the object represents, invoke the object's setName method. In the invocation of the setName method, pass a string that contains the name of the node as a parameter to the method.

The object that represents a statistic must also provide methods for computing the statistic from event data.

The org.glassfish.flashlight.statistics package provides the following utility classes to gather and compute statistics data:

Average

Provides averages.

Counter

Provides a counter that a class can use to maintain count.

TimeStats

Provides timing information in seconds.

TimeStatsMillis

Provides timing information in milliseconds.

TimeStatsNanos

Provides timing information in nanoseconds.


Note –

The classes in the org.glassfish.flashlight.statistics package are unstable interfaces and are subject to change.


The org.glassfish.flashlight.statistics.factory package provides a factory class for each utility class as shown in the following table.

Utility Class 

Factory Class 

Average

AverageFactory

Counter

CounterFactory

TimeStats

TimeStatsFactory

TimeStatsMillis

TimeStatsFactory

TimeStatsNanos

TimeStatsFactory