Chapter 7. Instrumentation

Chapter 7. Instrumentation

7.1. XML descriptor
7.2. Annotation
7.2.1. JDK1.4
7.2.2. JDK5.0
7.2.3. JDK5.0 field level annotations
7.3. Weaving
7.3.1. Ant target for running load-time instrumentation using specialized class loader
7.3.2. Ant target for aopc
7.3.3. Ant target for annotation compiler

In this chapter, we explain how to instrument (or "aspectize") the POJOs via JBossAop. There are two steps needed by JBossAop: 1) POJO declaration, 2) instrumentation. But depends on the JDK and instrumentation mode that you are using, you may not need to pre-process your POJO at all. That is, if you use JDK5.0 and load-time mode, then all you need to do is annotation your POJO (or declare it in a xml file). This makes your PojoCache programming nearly transparent.

For the first step, since we are using the dynamic Aop feature, a POJO is only required to be declared "prepare". Basically, there are two ways to do this: either via explicit xml or annotation (new since release 1.2.3.)

As for the second step, either we can ask JBossAop to do load-time (through a special class loader, so-called loadtime mode) or compile-time instrumentation (use of an aopc pre-compiler, so-called precompiled mode)