Skip to main content

Beat the Clock

Posted by editor on June 23, 2008 at 6:55 AM PDT

Performance and debugging tools getting better

Since it's been a while since I wrote anything really big -- I used to say that Java gets interesting and scripting languages get impractical around 10,000 lines -- I feel like I've fallen behind in terms of what's happening on the performance and debugging front. I recently saw a demo of the "instruments" used for Mac OS X debugging and came away highly impressed. Along with traditional tools for tracing back through an object's allocation stack to see where your leaks are coming from, they have tools specific to the pathologies of Cocoa programming, like tracking "zombies", deallocated objects that still have pointers to them. While Java's memory management protects us from those problems, I came away thinking that tools adapted to the specific problems that Java developers typically face would be highly useful. And for all I know, these may already exist in NetBeans and the like; I just haven't had cause to go looking for them.

On the other hand, if they don't, then what kind of programming anti-patterns would you like a problem-specific debugging tool help you with? Leaking memory because you've mistakenly added or inserted something into a collection, with no corresponding remove? Race conditions because you make calls from multiple threads into thread-unsafe code? What other common mistakes are out there that could be tooled out of existence?

Helping you to debug and speed up your code, this week's Spotlight is on

BTrace, a safe, dynamic tracing tool for the Java platform. BTrace can be used to dynamically trace a running
Java program (similar to DTrace for OpenSolaris applications and OS). BTrace dynamically instruments the classes of the target application to inject tracing code
("bytecode tracing"). Tracing code is expressed in Java programming language. There is also integration with
DTrace for the OpenSolaris platform. There will be a VisualVM plugin
for BTrace soon - so that the users can trace their application from the VisualVM client. Alternatively, if you'd prefer you can run BTrace from command line shells as well. BTrace is available under GNU Public License v.2 w/Classpath Exception.

In Java Today,
the new Atmosphere project "is a POJO based framework using Inversion of Control (IoC) to bring push/Comet to the masses. Finally a framework which can run on any Java based Web Server, including Tomcat, Jetty, GlassFish, Resin, Jersey, RESTlet etc., without having to wait for Servlet 3.0 or without the need to learn how push/Comet support has been differently implemented by all those Containers." The Aquarium has more details about the project's launch in Bringing Comet to the Masses - Atmosphere.

A new SDN tutorial introduces techniques for Using the Scene Graph to Present Visual Objects in JavaFX Script. "This article describes a demo that uses the scene graph features in JavaFX. The demo provides nodes with three different types of contents and enables the user to apply animation and translucency effects. The user can select any combination of nodes to make them visible. The data binding mechanism is extensively used in this demo, providing an automatic synchronization of GUI elements and application data."

eBay team lead Cees de Groot has returned from TheServerSide Symposium convinced that scaling is the biggest issue Java developers will face in coming years, as he discusses in the Artima blog Java going bigger, bigger, bigger. "Scaling is something that every Java developer is going to have to deal with as hardware is converting to multi-cores. Two is the norm today, but we were told to expect a doubling of cores every 18 months or so (yup, Moore's law still seems to hold), meaning that a measly notebook will likely have 8 cores in three years, and servers will typically ship with 32 cores. In order to use that horsepower, software needs to change to parallelism which means that every Java developer has to read up on multi-threading, synchronization (and why you should avoid both), java.util.concurrent (and why you want it), etcetera."

In today's Weblogs, Fabrizio Giudici has further reaction to last week's IcedTea news in IcedTea passed the TCK - implications for (desktop) developers? "Rich Sharples is blogging about the fact that IcedTea passed the TCK (via Heiko W. Rupp); Fedora 9 is the first Linux distribution to carry a completely free and unencumbered version of Java It's an important milestone of the open sourcing of Java initiated by Sun, excellent news."

Arun Gupta continues his tips series in
TOTD #34: Using Felix Shell with GlassFish.
"TOTD #33 explains how to create a GlassFish v3 distribution that uses Apache Felix (default) as the OSGi R4 Service Platform runtime. This blog explains how to use Felix Shell TUI with that bundle to issue commands to the OSGi framework and obtain information from it."

Finally, in
Most detailed JSF 2.0 reader: Manfred Riem, Ed Burns writes, "gives props to Manfred Riem for being such a diligent reader of the JSF 2.0 spec."

In today's Forums,
SwingX user skjalgb has a suggestion for changing the
JXLayer contains method.
"I have a special case of use for JXLayer without the use of a LayerUI . This is a i18n keyboard for touch panels. However, as demonstrated in the small sample program underneath, mouse events are (in my opinion) incorrectly filtered out in the current implementation of JXLayer. There are several ways around the problem, but I think the best would be to change a line of code in the contains method. What do you think?"

cowwoc collaborates on a bug hunt in
Re: Font rendering bug in Update 10?
"Good catch! I tracked this down to a bug in the Netbeans form editor. It seems that with Tohoma 11 it doesn't add a setFont() instruction to the code, so it displays one thing in the Form editor and another thing at runtime."

qu0ll asks,
Can I know when and how an applet is run from GlassFish?
"Is it possible to determine (perhaps from log files) exactly which files are downloaded when a client runs an applet served from GlassFish v2 ur2 and when the applet was run? I ask because I need to know that the packed version of the applet's JAR files are being used in preference to the original unpacked JAR files as part of a verification process for the Java pack200 tool. I also need to know exactly when the applet is run on a client machine."

Current and upcoming Java

Registered users can submit event listings for the href=""> Events Page using our href="">events submission form.
All submissions go through an editorial review before being posted to the

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 it will be
archived along with other past issues in the href=""> Archive.

Performance and debugging tools getting better