JBoss.org Community Documentation

Chapter 6. Instrumentation

6.1. Load-time instrumentation
6.2. Compile-time instrumentation
6.3. Understanding the provided AOP descriptor
6.4. Annotation
6.4.1. POJO annotation for instrumentation
6.4.2. JDK5.0 field level annotations
6.5. Weaving
6.5.1. Ant target for running load-time instrumentation using specialized class loader
6.5.2. Ant target for aopc

In order to store an object in POJO Cache, it must be either instrumented or made serializable. Instrumentation is the most optimal approach since it preserves object identity and provides field granular replication. POJO Cache currently uses the JBoss AOP project to provide instrumentation, so the same processes described in the AOP documentation are used with POJO Cache.

The primary input to JBoss AOP is the AOP binding file, which is responsible for specifying which classes should be instrumented. POJO Cache provides a binding file, pojocache-aop.xml , which matches all classes that have been annotated with the @Replicable annotation. Advanced users may choose to alter this definition to instrument classes in other various interesting ways. However, it is recommended to just stick with the default annotation binding.

The instrumentation process can be executed at either load-time, or compile-time. Load-time instrumentation uses a Java agent to intercept and modify classes as they are loaded; whereas compile-time instrumentation requires running aopc as part of the compilation process.

Note

Load-time is the recommended approach, since compile-time instrumentation adds hard dependencies to the weaved bytecode which ties the output to a particular version of JBoss AOP.