[jboss-dev-forums] [Design of JBossCache] - Re: JBossCache 2.1.0 - AOP framework

adrian@jboss.org do-not-reply at jboss.com
Fri Jul 6 08:45:08 EDT 2007


Of course you should use JBoss AOP. I can think of a number of reaons,
but probably the most compelling for you (and me but more importantly users :-) are:

1) If you have problems it is relatively trivial to get a fix/resolution in a "one stop shop"
at jboss.org

2) A user doesn't need to understand two sets of configuration to configure JBoss Cache
with other JBoss AOP usage in the same application (e.g. JBoss AS)

3) It's possible to use JBoss AOP without any "weaving" (either compile time
or load time) with the JBoss AOP proxy
e.g. the JCA prototype does exactly what you are doing (implement a project
using AOP for the design) but adds the AOP "on the fly" without any special help
from the classloading. 

4) JBoss AOP works. Its unlikely that your own handwritten framework
has had the same amount of exposure to testing. It almost certainly contains more
bugs. :-)

5) Aspects written for other projects are usuable in your project (and vice versa)

6) There are some interesting features in the JBoss AOP/MC integration
that are not available anywhere else. One trivial example is the
"bind my object into JMX".


  | @JMX
  | public class CacheImpl {}
  | 

Whether it actually does bind it into JMX is dependent not upon you
writing code to do this, but adding the aspect to the aop config to say
what the annotation @JMX means.
No such aspect means there is no binding, and you can choose
what the implementation of the aspect is according the environment.

But there are other more interesting examples, such as proper
dependency management of aspects applied to a bean, e.g.


  | @Tx(TxAttribute.REQUIRED)
  | public class MyClass {}
  | 

But @Tx introduces the transaction demaraction aspect
which has a dependency on the transaction manager

  | @Aspect
  | public class TransactionDemarcation 
  | {
  |   @Inject
  |   public void setTransactionManager(TransactionManager tm) {}
  | 
  |   public Object invoke(Invocation) throws Throwable {}
  | }
  | 

Only with JBoss AOP/MC does this transient dependency get recognised
and properly resolved, i.e. MyClass won't be installed until
TransactionDemarcation is installed which in turn requires the TransactionManager
installed.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061275#4061275

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061275



More information about the jboss-dev-forums mailing list