Search |
||
What's The Matter With YouPosted by editor on April 24, 2008 at 7:12 AM PDT
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." In 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,
Finally, Current and upcoming Java Events :
Registered users can submit event listings for the java.net Events Page using our events submission form. All submissions go through an editorial review before being posted to the site. Archives and Subscriptions: This blog is delivered weekdays as the Java 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 java.net Archive. Looking at and modifying classes as they're loaded »
Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|