Skip to main content

Couldn't I Just Tell You?

Posted by editor on January 26, 2006 at 7:07 AM PST

Event handling throughout Java

Something I thought was funny while editing today's feature article was a feeling of deja vu. In discussing a server-side event-distribution framework that supports multiple, pluggable listeners, the author proposed the idea of an event-handler which took little or no action, and was meant to be extended with more sophisticated handling.

And I'm like... yeah, in AWT and JavaBeans, this is the concept of the "Adapter".

What I realized is that when we talk about event-handling, Java and its various extensions have expresed the same concept in many diferent ways, depending on the context. JMS messages, AWTEvents, Jini RemoteEvents, JavaBeans PropertyChangeNotifications, java.util's Observer and Observable, and others all speak to the same concept, the idea of registering interest events and receiving callback-style notifications of them. After all, this is all really the Gang of Four's Observer pattern in many guises.

So... am I wondering aloud why there isn't a single uber-API that would provide event-handling in every context? No thanks. Distributed systems, servers, and GUIs have different needs, and it probably makes sense to tune API's for those cases rather than, say, add networkable events to GUIs that don't need them. Besides, I rolled my own distributed event system once and walked into a baffling OutOfMemoryError bug that ended up involving Swing TreeModels and distributed garbage collection. It's better for everyone if those worlds stay apart when possible.

In Server-Side Typed Event Distributors, today's
Feature Article, Satya Komatineni says event processing isn't just for GUIs and enterprise messaging systems anymore. Even an HTTP server can be seen as processing a series of events, and it can be advantageous to wire up one or more handlers to each event. In this article, he shows how to build an event distribution framework and what it can do for you.

The clarified timeline for Mustang and Dolphin, revealed in Ray Gans' Where We Are With the JDK, has kicked off several responses in today's Weblogs.
Mustang Beta approaching - we want to know about your bugs and regressions, David Herron writes:
"This is where you come in. You have your application and your environment. Please, now is the time to begin taking a serious look at whether Java 6 (a.k.a. Mustang) will successfully run your application."

Calvin Austin wonders what things would be like If Java was a car, in which he asks "And is the delay of JDK 6.0 Mustang a good thing?"

Interceptors with EJB 3, Meeraj Kunnumpurath writes:
"I have been having a look at EJB 3.0 interceptors with Glassfish. EJB 3.0 allows you to define interceptor methods that are called around the business methods and lifecycle events on the bean instances. Here, I will try to provide a simple example of using interceptors on business methods using annotations."

In Also in
Java Today

Joel Spolsky, of the Joel on Software site, is kicking off a new series on design, with an Introduction to Great Design. Using the pathological example of a mobile phone which is turned on with its red button, he writes: "it's surprising just how many of today's devices and gadgets and remote controls have actually made TVs, stoves, and telephones harder to use. Suddenly, bad computer user interface design is seeping into the entire world."

For those adopting EJB 3 and using Hibernate for persistence, JBoss' Andrew C. Oliver has posted a mini-guide of performance tuning practices in the blog entry Hibernate/EJB3 Tuning: "These are the top 8 things I tend to find when tuning Hibernate/EJB3 apps. I am going to talk about this predominantly in Hibernate terms but most of it applies to EJB3 persistence (some of the detached object/etc stuff is a bit Hibernate specific) as well. All of it obviously applies to JBoss's EJB3 persistence implementation (which is Hibernate) either by default or through the use of 'extensions'."

In Projects and
voting is underway in the 2006 JXTA Elections, which are being held to fill two open seats on the JXTA Board of Directors. Balloting ends at midnight PST on February 1, and the two winners will serve a one-year term starting March 1. There is also a referendum on the ballot to extend board members' terms to two years.

If you'd like to join fellow community members at JavaOne 2006, acting soon could save you some money. A new "Super Saver Discount" can save you up to $400 off the on-site price if you register for JavaOne before February 15. The conference runs from May 16 - 19 in San Francisco's Moscone Center.

In today's Forums,
jurna wonders about the state of
Escape analysis and stack allocation:
"There have been quite a lot of posts on the net about Mustang's escape analysis and stack allocation capabilities. But recently I can't find any progress on that topic. I know that escape analysis is already performed, but stack allocation is not implemented yet. Is this feature still planned for Mustang?"

In Re: Another "Entities are not POJOs" scenario, dibyendumajumdar writes:
"The EJB specification uses the term 'managed' to mean entities that are known to the Entity Manager. I think a more literal term would be 'cached', as this is what appears to be happening. A managed entity is simply one that is in the cache of the Entity Manager. A 'detached' entity is one that isn't."