This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Thought you guys would be interested in a live demo of the upcoming JAMon 2.1 release (within the next couple weeks). The live demo shows how JAMon can monitor ANY JDBC driver, and ANY interface. Monitoring can be enabled/disabled at runtime, so there is no downside to use it even on production systems. JAMon 2.1 requires JDK 1.4 or higher. The following is a brief description of JAMon and its demo app available at the following link: http://www.ssouza.com/JAMon
1) JAMon can monitor ANY Java interface. This can be any interface of your own creation or even interfaces that come with the JDK such as the JDBC interfaces (This is particularly useful). The syntax couldn't be simpler. Simpy pass ANY interface in the 'monitor(...)' method it will be monitored. If the monitor proxy is disabled then the original object is simply returned causing no run time performance impacts. Monitoring is quite fast though, and various levels can be enabled/disabled at runtime.
// After monitoring the interfaces, subsequent calls to the monitored object will track various statistics discussed below // This will also monitor all SQL, calls to the JDBC interfaces (Statements, PreparedStatements, CallableStatements and ResultSets) and any Exceptions that // they throw. Connection monitoredConnection = MonProxyFactory.monitor(connection);
// You monitor your own custom interfaces the same way. MyInterface myMonitoredObject = MonProxyFactory.monitor (new MyObject());
2) What type of monitoring does JAMon 2.1 do? All JAMon data can be viewed in the various JAMon web pages discussed below. All of the following can be enabled/disabled at runtime. 2.1) JAMon Summary statistics such as hits, time (avg/min/max/total/...), conncurency (what is currently running? what was the max running?...), and more. For example for all queries for any JDBC driver you can track how many times it was called, avg time, max time etc. Summary stats are kept for all methods on an interface, SQL, exceptions thrown and more. (see http://www.ssouza.com/JAMon/JAMonAdmin.jsp for examples) 2.2) SQL Details - The above tracks aggregate/summary statistics. JAMon can also track the most recent N (configurable) SQL statements that have run. This capability will show 1) The query, 2) When the query ran, 3) How long the query took, 4) If the SQL was called via a PreparedStatement how many times has that PreparedStatement been reused, 5) Did the query throw an Exception and if so it will show its stacktrace, and a few more things. (see http://www.ssouza.com/JAMon/sql.jsp) 2.3) Exception Details - Should any monitored interface throw an Exception it will be kept in the SQL details buffer. This will allow developers to look at actual stack traces in a web page as opposed to combing log files. (see http://www.ssouza.com/JAMon/exceptions.jsp)
3) The menu also has a link to a page that can exercize JAMon monitoring by running HSQLDB queries. When you click on 'Generate Data!' from (see http://www.ssouza.com/JAMon/query.jsp), several queries will be run and monitored, an Exception will be thrown and a custom interface will be monitored. You can look at the code by viewing the 'Show Code!' button.
4) The next version of jamon will have jdbc drivers that will allow developers to monitor jdbc with no code changes.