db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Jefferson <a...@datanucleus.org>
Subject Re: Enhancing using ClassFileTransformer.
Date Thu, 22 Jan 2009 19:40:36 GMT
> Quick question: Can anyone post a link with a description (or just
> describe it here) of how the VM interacts with the instrumentation API
> to process the bytestream of a class using ClassFileTransformer?
> Does the VM invoke the class loader to find a class first, before
> handing the class definition off to the ClassFileTransformer?  I assume
> this is so but I want to be sure.

From what I remember the JVM will receive a request to load a class. It 
retrieves the bytes of the class. It then calls the method "transform" of 
the "Premain-Class" (specified in the MANIFEST.MF of the enhancer jar) with 
the input bytes for the class. This method can transform the bytecode of that 
class and return it, or return null (meaning there is no change to the class 
definition).

See
http://datanucleus.svn.sourceforge.net/viewvc/datanucleus/platform/enhancer/trunk/src/java/org/datanucleus/enhancer/DataNucleusClassFileTransformer.java?revision=2302&view=markup

That's about it.

-- 
Andy  (DataNucleus - http://www.datanucleus.org)

Mime
View raw message