JBoss.org Community Documentation

6.1. Load-time instrumentation

Load-time instrumentation uses a Java agent to intercept all classes loaded by the JVM. As they are loaded JBoss AOP instruments them, allowing POJO Cache to monitor field changes. To enable load time instrumentation the JVM must be started with the following specified:

  1. The jboss.aop.path system property set to the location of pojocache-aop.xml

  2. A javaagent argument which includes jboss-aop-jdk50.jar

These requirements lead to the following example ant task:

<java classname="Foo" fork="yes">
   <jvmarg value="-javaagent:lib/jboss-aop.jar"/>
   <jvmarg value="-Djboss.aop.path=etc/META-INF/pojocache-aop.xml"/>
   <classpath refid="test.classpath"/>

There is also a pojo-run command line script in the POJO Cache distribution that passes the proper arguments to the JVM for you.

$ pojo-run -classpath myclasses org.foo.Bar

Once the JVM is executed in this manner, any class with the @Replicable annotation will be instrumented when it is loaded.