blob: c0fce03920fae95fa32c066fc2c0bfc97f52e1a5 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!--
Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
</head>
<body bgcolor="white">
Provides for <b>implementations of various Stats interfaces.</b> These Stats interfaces
are based on those defined by JSR 77. Besides this, implementations of
various Statistic interfaces are also provided here. A new Statistic is
introduced named <b> StringStatistic </b>.
<P>
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 <EM> getCount </EM> 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.
<P>
To solve this problem, this package makes the following provision:
<P>
It defines Statistic classes that have a <i>State</i>. A component that gathers
data has to do the following:
<ul>
<li> Implement the specific Stats interface. e.g. EJBCacheStats. This interface
has a method which returns number of beans in cache as an instance of BoundedRangeStatistic.
</li>
<li> Initialize an instance of MutableBoundedRangeStatistic with an initial
state. This interface exposes all the necessary methods that are required
to reflect the change in state. </li>
<li> Since MutableBoundedRangeStatistic provides a method that returns an unmodifiable
view of itself, calls the MutableBoundedRangeStatistic.unmodifiableView()
which returns BoundedRangeStatistic. This returned value can safely be sent
to the caller to which everything is transparent.</li>
</ul>
Note that these Mutable* interfaces/classes are not exposed to clients. Clients
will only receive instances of Statistics that are part of the J2EE Management
Standard.
<h2>Package Specification</h2>
Following Stats interfaces are part of this package. All of these extend the
org.glassfish.j2ee.statistics.Stats interface.
<ul>
<li>EJBCacheStats</li>
<li>EJBMethodStats</li>
<li>EJBPoolStats</li>
<li>OrbConnectionManagerStats</li>
<li>OrbThreadPoolStats</li>
<li>SunOneJVMStats</li>
</ul>
Following new Statistic interfaces are defined by this package. They extend the
org.glassfish.j2ee.statistics.Statististic interface.
<ul>
<li>StringStatistic - A String equivalent of CountStatistic.</li>
<li>MutableStatistic - A Statistic that has some mutators. It is expected to
be handled with care.</li>
<li>MutableCountStatistic - A CountStatistic/BoundedRangeStatistic that is mutable.</li>
<li>MutableTimeStatistic - A TimeStatistic that is mutable.</li>
</ul>
<p>Following are the implementations of various Statistic interfaces in org.glassfish.j2ee.statistics
package.</p>
<table width="60%" border="1">
<tr bgcolor="#0066FF">
<td>Interface</td>
<td>Immutable Implementation (read-only -- for clients)</td>
<td>Mutable Implementation (read-write -- for core components)</td>
</tr>
<tr>
<td>CountStatistic</td>
<td>CountStatisticImpl</td>
<td>MutableCountStatisticImpl<br>
It implements MutableCountStatistic.</td>
</tr>
<tr>
<td>BoundedRangeStatistic</td>
<td>BoundedRangeStatisticImpl</td>
<td>MutableBoundedRangeStatisticImpl<br>
It implements MutableCountStatistic.</td>
</tr>
<tr>
<td>TimeStatistic</td>
<td>TimeStatisticImpl</td>
<td>MutableTimeStatisticImpl<br>
It implements MutableTimeStatistic.</td>
</tr>
</table>
<p>&nbsp; </p>
Following is a helper implementation done in this package: GenericStatsImpl.
<p>
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:
<ul>
<li>getStatistic(String)</li>
<li>getStatistics()</li>
<li>getStatisticNames()</li>
</ul>
in a reflective manner. Thus, e.g. a specific implementation of EJBPoolStats like
EJBPoolStatsImpl can make use of this class to implement above methods in a
generic manner.
<h2>Related Documentation</h2>
<p>{@link org.glassfish.j2ee.statistics}<br>
{@link java.util.Collections#unmodifiableMap}<br>
{@link java.util.Collections#unmodifiableSet}<br>
</p>
<p>@since S1AS8.0 </p>
</body>
</html>