net.grinder.util.weave.j2se6
Class DCRWeaver

java.lang.Object
  extended by net.grinder.util.weave.j2se6.DCRWeaver
All Implemented Interfaces:
Weaver

public final class DCRWeaver
extends Object
implements Weaver

Weaver that uses Java 6 dynamic class retransformation.

Author:
Philip Aston

Nested Class Summary
static interface DCRWeaver.ClassFileTransformerFactory
          Factory that generates ClassFileTransformers which perform the weaving.
 
Nested classes/interfaces inherited from interface net.grinder.util.weave.Weaver
Weaver.TargetSource
 
Constructor Summary
DCRWeaver(DCRWeaver.ClassFileTransformerFactory transformerFactory, Instrumentation instrumentation)
          Constructor.
 
Method Summary
 void applyChanges()
          Apply pending weaving that has been requested with Weaver.weave(java.lang.reflect.Constructor).
 String weave(Constructor<?> constructor)
          Queue the given constructor for weaving, and return a unique identifier that can be used by the advice to refer to the constructor pointcut.
 String weave(Method method, Weaver.TargetSource targetSource)
          Queue the given method for weaving, and return a unique identifier that can be used by the advice to refer to the method pointcut.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DCRWeaver

public DCRWeaver(DCRWeaver.ClassFileTransformerFactory transformerFactory,
                 Instrumentation instrumentation)
Constructor.

Parameters:
transformerFactory - Used to create the transformer.
instrumentation - Access to the JVM instrumentation.
Method Detail

weave

public String weave(Constructor<?> constructor)
Queue the given constructor for weaving, and return a unique identifier that can be used by the advice to refer to the constructor pointcut.

Once Weaver.weave(java.lang.reflect.Constructor) has been called for a constructor, subsequent calls are no-ops that will return the identifier generated for the original call.

The instrumentation will not be applied to the code until Weaver.applyChanges() is called.

Specified by:
weave in interface Weaver
Parameters:
constructor - The constructor.
Returns:
String that uniquely identifies the pointcut.

weave

public String weave(Method method,
                    Weaver.TargetSource targetSource)
             throws WeavingException
Queue the given method for weaving, and return a unique identifier that can be used by the advice to refer to the method pointcut.

Once Weaver.weave(java.lang.reflect.Constructor) has been called for a method, subsequent calls are no-ops that will return the identifier generated for the original call.

The instrumentation will not be applied to the code until Weaver.applyChanges() is called.

Specified by:
weave in interface Weaver
Parameters:
method - The method.
targetSource - Which object should be passed as the target to the advice.
Returns:
String that uniquely identifies the pointcut.
Throws:
WeavingException - If the targetSource is incompatible with the method.

applyChanges

public void applyChanges()
                  throws WeavingException
Apply pending weaving that has been requested with Weaver.weave(java.lang.reflect.Constructor).

Specified by:
applyChanges in interface Weaver
Throws:
WeavingException - A problem occurred with the weaving.


Copyright © 2000-2013. All Rights Reserved.