What's The Matter With You
Looking at and modifying classes as they're loaded
A few years ago while editing ONJava, we published a number of articles on fairly exotic techniques -- mostly involving bytecode manipulation and aspect-oriented programming -- to modify and transform existing Java code. There were plausible use cases, but to pull these things off, you often had to use a different virtual machine for AOP, or do some spectactularly heavy lifting for bytecode manipulation. Each approach had its adherents, but both remained pretty fringey, surely due in part to the non-standard, high-difficulty details of using them.
So, if there were something built into Java SE that allowed you to inspect and modify existing classes, without recompilation and without having to wrangle JVM opcodes yourself, would that be worth further investigation? Well...
In our Feature Article, ThorbjÃ¸rn Ravn Andersen looks at how to
Add Logging at Class Load Time with Java Instrumentation. Java Instrumentation, introduced in Java SE 5, offers an interesting ability to manipulate class bytecode as its loaded by the classloader. In this article, ThorbjÃ¸rn offers a simple example of this feature by adding logging statements to the beginning and end of all methods of an arbitrary class.
It's actually a surprisingly short article (only about 1,200 words, not counting code), and not an unreasonable API to get the hang of. ThorbjÃ¸rn combines Instrumentation with the JBoss javassist library to do the tricky parts of modifying the bytecode. Take a look and see if this is something that might be a useful addition to your own toolkit.
If you read today's blog in the next few hours (before 8:00 AM PDT, 15:00 GMT), you may want to check out the CEE Tutorial and Q&A: Tutorial For New Project Owners. Collabnet is hosting this tutorial and Q&A for new java.net project owners. You can join the online meeting with WebEx, or just the teleconference by phone. Check out the info page for specific instructions, technical requirements, and assistance.
In Java Today,
Pramod Gopinath and Rick Palkovic have posted a new SDN artcile on Using MySQL and Memcached on the GlassFish Application Server. "Many developers use memcached and MySQL to cache content as part of their web application. This article presents a simple example application that uses MySQL and accesses a memcached server. The application is deployed on the GlassFish application server."
The newly-unveiled Trackbotcode project provides runtime libs, example and test code for Systronix TrackBots. It's a "PC-based application which connects to TrackBot through a DCE serial adapter and enables testing and characterization of all eight IR sensors on the TrackBot platform. It includes a screen-based text/graphical display of sensor response in all three sensitivity settings. Command line parameters include which pair of the eight sensors to test at a time. The code reports any errors and timeouts, and has been very useful in analyzing PC serial port performance."
TheServerSide has posted sample chapter from David Heffelfinger's book, Java EE 5 Development using Glassfish. In Chapter 8, the author covers how to secure Java EE applications by taking
advantage of GlassFish's built-in security features. Topic include security realms, the specifics of the admin, file, certificate, and JDBC realms, creating self-signed security certificates, and building custom realms.
In today's Weblogs,
JohnÂ O'Conner has posted his list of the
Top 10 Desktop Sessions at JavaOne 2008.
"Here are the top 10, must-see Java Desktop sessions at JavaOne 2008, the Desktop sessions that will influence you the most in the coming year."
Hudson plugin for WAR/EAR deployment / Cargo support in GlassFish, KohsukeÂ Kawaguchi announces "a new plugin Hudson to deploy a war to app servers, and a call for help for GlassFish support in Cargo."
The latest in ArunÂ Gupta's tips series is
TOTD #31: CRUD Application using Grails - Hosted on GlassFish and MySQL.
"TOTD #30 explained how to create CRUD application using Grails and hosted using in-built Jetty servlet engine and in-memory HSQLDB database. Jetty and HSQLDB are good for development environment. However a robust environment such as GlassFish and MySQL are required for production environment. This blog entry walks you through the steps of deploying a Grails application on GlassFish and MySQL."
In today's Forums,
kirillcool notes odd performance differences in
Re: [JAVA2D] Performance regression in 6u10 b22.
"Something even more interesting. I've ran the same performance suite on two machines, one having integrated Intel card, and another with NVidia card (from my previous reply). Both have Vista SP1 installed, both have dual-core CPU. Running the suite on integrated card takes 140ms on Substance and 71ms on Nimbus. Running the suite on NVidia card takes 500ms on Substance and 417ms on Nimbus This is under the b22 of 6u10. The first machine has dual-core Intel 1.66GHz with 2GB RAM, the second machine has dual-core AMD 1.80GHz with 1GB RAM. Shouldn't i see a bigger difference favoring Nimbus in the second scenario?"
carlavmottannounces a new scheme for
jMaki version numbers.
"We're working on a release before JavaOne and want to get a beta release of the 1.1 code out this week. As you have seen we are working on jMaki 1.1. We have received lots of comments saying that the version numbering for the different artifacts ( standalone bundle and plugins) is confusing. To try and remedy this we will change the version number all artifacts to 1.8 with the beta release. There will not be a final release of the 1.1 code but instead we will move directly to 1.8 for the plugins and the standalone bundle. It will still be a beta quality release. The final release will be numbered 1.9. We hope that making the version numbers the same for all release will remove confusion going forward."
andrewherron argues the coffee cup system tray icon isn't so bad, in
Re: Feedback on new applet plugin.
"I've seen a few posts on the Java tray icon, and I want to add my vote for keeping it. The icon is an easy cross-browser method for end users to open the Java console, an absolute necessity when trying to provide customer support. Instead of messing around with a list of ways to open the console based on the browser they're using, we simply tell them to right click the coffee cup in the system tray and open the console that way I don't see how a little icon in the tray counts as degrading the UI, sure the little bubble popup is annoying but it only appears once. I doubt most people notice it after that."
Current and upcoming Java
- AprilÂ 25-27 - Northern Virginia Software Symposium 2008: Spring Edition
- MayÂ 2-4 - Rocky Mountain Software Symposium 2008: Spring Edition
- MayÂ 5-9 - Java Training Philippines
- May 5 - CommunityOne 2008
- MayÂ 6-9 - JavaOne 2008
- MayÂ 12-15 - Java Power Tools Bootcamp
- MayÂ 16-18 - Greater Oklahoma Software Symposium
- MayÂ 19-23 - Daring Java Conference: Java to Celebrate Its 13th Birthday at Bangalore
- MayÂ 19-23 - Great Indian Developer Summit 2008 Features Co-located Conferences on Java, Rich Web and .NET
- MayÂ 19-23 - J2EE Training Philippines
- JuneÂ 18-20 - TheServerSide Java Symposium-Europe
- JuneÂ 23-26 - Jazoon'08
Registered users can submit event listings for the
href="http://www.java.net/events">java.net Events Page using our
href="http://today.java.net/cs/user/create/e">events submission form.
All submissions go through an editorial review before being posted to the
Archives and Subscriptions: This blog is delivered weekdays as
Today RSS feed. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.
Looking at and modifying classes as they're loaded