JBoss: Implementing Middleware Using AOP

Posted on March 21, 2005


Bill Burke presented how JBoss is using AOP to provide transparent middleware. It was interesting to hear JBoss’s new message that most of their users want to use aspects but not program them. They are promoting the message of annotations for ease of use and aspects for ease of extension. At the same time, JBoss is making extensive use of aspects: it’s the basis of their EJB3 container (log, security, transactions, locks, remoting, etc.). It’s great to have the fastest growing J2EE container build the core of their new platform on AOP!

Their transparent replicated JBoss Cache is a very cool application of aspects. Interestingly, they are using aspects to build it for product line variation. It lets them provide pluggable eviction, persistence, replication, and transactionality support without tangling the core cache code. They’ve also been able to use "advice stacks" to provide common elements for different J2EE components (SSB, SLSB, MDB, …), while capture the variations. The advice stack concept in JBoss AOP is a kind of composite pattern; it would be interesting to better understand how it compares to AspectJ-style aspects.

They are also going to provide a capability to use XML to define or override programmatic @Annotations, and they allow changing annotations on a per instance basis. JBoss AOP lets one configure metadata per invocation, thread, class, vm, or cluster.

They see it as important to be able to hot deploy aspects (binding or unbinding at runtime, e.g., to add metrics at runtime). They also support per-instance advice. Bill told me that the weaver adds if tests, so this should be performant even for call join points.

Futures for JBoss AOP include a DI/IoC container in the manager environemnt and potentially being able to defer initialization until all dependencies are available.