|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springsource.loaded.agent.GroovyPlugin
public class GroovyPlugin
What does it do?
So far the GroovyPlugin can do two different things - configurable through the 'allowCompilableCallSites' flag.
If the flag is false: The plugin intercepts two of the main system types in groovy and turns OFF call site compilation. Without this compilation the compiler will not be generating classes, it will instead be using reflection all the time. This is simpler to handle (as we intercept reflection) but performance == thesuck.
If the flag is true: The plugin leaves groovy to compile call sites. We intercept the define method in the classloader used to define these generated call site classes and ensure they are rewritten correctly. Note there is an alternative here of getting the SpringLoadedPreProcessor to recognize these special classloaders and just instrument them that way. However, if we let the plugin do it it is easier to test!
To see the difference in these approaches, check the numbers in the Groovy Benchmark tests.
| Constructor Summary | |
|---|---|
GroovyPlugin()
|
|
| Method Summary | |
|---|---|
boolean |
accept(java.lang.String slashedTypeName,
java.lang.ClassLoader classLoader,
java.security.ProtectionDomain protectionDomain,
byte[] bytes)
Called by the agent to determine if this plugin is interested in changing the specified type at load time. |
byte[] |
modify(java.lang.String slashedClassName,
java.lang.ClassLoader classLoader,
byte[] bytes)
Once accept has returned true for a type, the modify method will be called to make the actual change to the classfile bytes. |
static void |
recordInstance(java.lang.Object obj)
|
void |
reloadEvent(java.lang.String typename,
java.lang.Class<?> clazz,
java.lang.String versionsuffix)
Called when a type has been reloaded. |
boolean |
shouldRerunStaticInitializer(java.lang.String typename,
java.lang.Class<?> clazz,
java.lang.String encodedTimestamp)
Called when a type has been reloaded, allows the plugin to decide if the static initializer should be re-run for the reloaded type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GroovyPlugin()
| Method Detail |
|---|
public boolean accept(java.lang.String slashedTypeName,
java.lang.ClassLoader classLoader,
java.security.ProtectionDomain protectionDomain,
byte[] bytes)
LoadtimeInstrumentationPlugin
accept in interface LoadtimeInstrumentationPluginslashedTypeName - the type name, slashed form (e.g. java/lang/String)classLoader - the classloader loading the typebytes - the classfile contents for the type
public byte[] modify(java.lang.String slashedClassName,
java.lang.ClassLoader classLoader,
byte[] bytes)
LoadtimeInstrumentationPlugin
modify in interface LoadtimeInstrumentationPluginclassLoader - the classloader loading the typebytes - the classfile contents for the type
public static void recordInstance(java.lang.Object obj)
public void reloadEvent(java.lang.String typename,
java.lang.Class<?> clazz,
java.lang.String versionsuffix)
ReloadEventProcessorPlugin
reloadEvent in interface ReloadEventProcessorPlugintypename - the (dotted) type name, for example java.lang.Stringclazz - the Class object that has been reloadedversionsuffix - an encoded time stamp for this version, containing chars (A-Za-z0-9)
public boolean shouldRerunStaticInitializer(java.lang.String typename,
java.lang.Class<?> clazz,
java.lang.String encodedTimestamp)
ReloadEventProcessorPlugin
shouldRerunStaticInitializer in interface ReloadEventProcessorPlugintypename - the (dotted) type name, for example java.lang.Stringclazz - the Class object that has been reloadedencodedTimestamp - an encoded time stamp for this version, containing chars (A-Za-z0-9)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||