|
||||||||||
PREV NEXT | FRAMES NO FRAMES |
See:
Description
Packages | |
com.jamonapi | This package contains classes and interfaces used to monitor Java applications. |
com.jamonapi.utils | This package contains utility classes used by the JAMon implementation that are of general use beyond JAMon. |
The Java Application Monitor (JAMon v1.0) is a free, simple, high performance, thread safe, Java API that allows developers to easily monitor production applications.
JAMon can be used to determine application performance bottlenecks, user/application interactions, and application scalability. JAMon gathers summary statistics such as hits, execution times (total, average, minimum, maximum, standard deviation), and simultaneous application requests. JAMon statistics are displayed in the JAMon report.
JAMon was developed primarily for monitoring J2EE applications, however it can be used in any JDK 1.2 or higher environment. JAMon can be used in Servlets, JSP's, EJB's and Java Beans in various J2EE Application Servers (Sybase's EAServer, and BEA's WebLogic,…), and can also be used in other programming environments that can call Java code (ColdFusion, PowerBuilder, BroadVision, ...).
JAMon Implementation details
The implementation of JAMon uses several design patterns from the book "Design Patterns Elements of Reusable Object-Oriented Software" by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. A number of the creational patterns are used to create monitors. The convention is that any class involved in the creation of monitors has the word Factory in its name. Other patterns such as the command and iterator patterns are also used.
Despite JAMon's relatively high number of classes, in most cases the only methods that are required to begin monitoring are MonitorFactory.start(…), Monitor.stop(), and MonitorFactory.getReport(). Most of JAMon's classes are pretty simple and together have about 1,000 lines of code.
Most of JAMon's classes have test code in their main(...) methods. The main methods are also a good way to see how to call JAMon code. "TestClass" calls all main methods and performs a few extra tests. I run the TestClass's main() method whenever code changes are made to ensure that errors weren't introduced.
The decorator pattern dominates the design of JAMon. The decorator pattern is a way to chain objects with the same interface (Monitor), but different responsibilities. The following chaining of constructors (taken from MonitorLeafFactory) is a hint that the decorator pattern is being used.
TimingMonitor mon=new TimingMonitor(
new TimeStatsMonitor(
new ActiveStatsMonitor(
new LastAccessMonitor(
new TimeStatsDistMonitor()))));
When a method such as start(...) is called on the TimingMonitor (the mon variable in this case) the TimingMonitor performs its work and calls the start(...) method on the TimeStatsMonitor object which calls the start(...) method on the ActiveStatsMonitor object and so on down the decorator chain. The classes referenced in this decorator chain are the most important in JAMon and are responsible for tracking all JAMon statistics.
TimingMonitor - Monitor that keeps track of the time being measured by this monitor.
TimeStatsMonitor - Monitor that keeps track of various timing statistics such as max, min, average, hits, total, and standard deviation.
ActiveStatsMonitor - Monitor that Tracks whether or not a monitor is currently running (active).
LastAccessMonitor - Monitor that tracks when a Monitor was first and last called.
TimeStatsDistMonitor - Monitor that keeps track of statistics for JAMon time ranges.
The outer most Monitor returned to the client in the decorator chain (a TimingMonitor) is unique per invocation of the start(...) method. All of the other Monitors in the chain gather summary statistics and are shared by every invocation of MonitorFactory.start(...) that is passed the same label. Because multiple threads may simultaneously attempt to update the summary statistics, Monitors are thread safe.
JAMon makes extensive use of HashMaps in storing Monitors. The label passed to "MonitorFactory.start("myMonitorLabel");" is the key to the HashMap and Monitors are the values. The HashMaps themselves are saved in a static variable, so the Monitors and the HashMaps don't get garbage collected even when Monitor's aren't executing.
JAMon consumes very few resources and is fast. On a 2 GHz Pentium IV, start() and stop() were were called 500,000 times in 1 second! JAMon can also be disabled at runtime to even further minimize impact on application performance.
For further information on JAMon look at the JAMon user's manual at www.jamonapi.com or review the source code which is also available via this site.
Steve Souza - admin@jamonapi.com (JAMon v1.0)
|
||||||||||
PREV NEXT | FRAMES NO FRAMES |