When we analyze the Statistic interfaces that are defined by the J2EE Management Standard, it is evident that they are view-only data structures providing the accessors for various statistical data, e.g. CountStatistic. Every instance of CountStatistic is allowed to have only a getCount method (in addition to other meta data accessors), that returns a long. This limits the usability of these Statistic interfaces by the actual components that gather the data, because new instances of these interfaces have to be constructed as and when a query or measurement of that statistic is made. On the other hand, it is much more flexible to have mutators within implementations of these Statistic interfaces. But then, there is a possibility that the client who receives instances of these interfaces inadvertantly changes a particular statistic.
To solve this problem, this package makes the following provision:
It defines Statistic classes that have a State. A component that gathers data has to do the following:
Following are the implementations of various Statistic interfaces in javax.management.j2ee.statistics package.
Interface | Immutable Implementation (read-only -- for clients) | Mutable Implementation (read-write -- for core components) |
CountStatistic | CountStatisticImpl | MutableCountStatisticImpl It implements MutableCountStatistic. |
BoundedRangeStatistic | BoundedRangeStatisticImpl | MutableBoundedRangeStatisticImpl It implements MutableCountStatistic. |
TimeStatistic | TimeStatisticImpl | MutableTimeStatisticImpl It implements MutableTimeStatistic. |
Following is a helper implementation done in this package: GenericStatsImpl.
This class is designed to facilitate the general implementation of {@link Stats} interface and all the classes that implement this interface can leverage this class. The main idea is that this class implements:
{@link javax.management.j2ee.statistics}
{@link java.util.Collections#unmodifiableMap}
{@link java.util.Collections#unmodifiableSet}
@since S1AS8.0