[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Load time weaving with AspectJ?



Filippo,

Load-time weaving in a middleware environment using AspectJ is comprised of
a weaving class loader, a weaving adaptor and an instance the weaver
itself. A weaving class loader is similar to a normal class loader in that
it locates the implementations of named types. In addition before loading
any classes it must define a set of aspects to the weaver and pass each
class it loads to the weaver before defining it in the JVM. The weaving
adaptor is designed to simplify the interaction between the weaving class
loader and the weaver.

In our WebSphere LTW prototype we modified an existing application class
loader to intercept its initialization and the call to "defineClass()"
where loaded bytecodes are passed to the JVM. During initialization we
instantiate a weaving adaptor (which in turn instantiates a weaver) and
pass it the full classpath use by the class loader and a set of aspects.
Then when each class is loaded it is passed to the weaving adaptor and the
resulting woven bytecodes defined in the JVM.

There are some rules for LTW which are enforced by the weaving adaptor:
1. The set of aspects must be defined before any class is loaded and remain
unchanged until the class loader is garbage collected.
2. All classes loaded by a weaving class loader must be by subject to
weaving.
3. Only classes defined by a weaving class loader can be woven.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/
                                                                           
             Filippo Diotalevi                                             
             <filippodiotalevi                                             
             @yahoo.it>                                                 To 
             Sent by:                  aspectj-users@xxxxxxxxxxx           
             aspectj-users-adm                                          cc 
             in@xxxxxxxxxxx                                                
                                                                   Subject 
                                       Re: [aspectj-users] Load time       
             08/09/2004 10:14          weaving with AspectJ?               
                                                                           
                                                                           
             Please respond to                                             
             aspectj-users@ecl                                             
                 ipse.org                                                  
                                                                           
                                                                           




Adrian, I've already read your interesting post.

Insn't it a bit strange that Bea supports AspectJ in its Weblogic and Ibm
does not?

Have you modified the classloader or maye it is possible to add a
pre-processor to the standard classloader (as I understand Bea uses this
approach)?



Adrian Colyer <adrian_colyer@xxxxxxxxxx> wrote:
 The capability has been in AspectJ since 1.1, but we packaged things up
 and made it a lot easier to use in 1.2. The 1.2 README has some
 information on this feature :

 http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/README-12.html#LTW


 In addition, I wrote a short introductory blog article on the topic a
 while back:

 http://www.aspectprogrammer.org/blogs/adrian/2004/05/loadtime_weavin.html

 BEA have a dev2dev pack which lets you use AspectJ for load-time weaving
 in WebLogic (though clearly they're doing a lot of work with AspectWerkz
 now too). We have used AspectJ for load-time weaving in WebSphere too
 (internally), but this requires some small changes to WebSphere's
 class-loading so that it would be difficult for end-users to replicate
 this capability at the moment. If there are users out there wh o would
 like
 us to support this feature (in WebSphere), we'd love to hear from you and
 especially to hear any use-cases you have for the feature - it all helps
 us to make an informed judgement about the right time and manner in which
 to introduce the capabilities.

 -- Adrian
 Adrian_Colyer@xxxxxxxxxx



 Filippo Diotalevi
 Sent by: aspectj-users-admin@xxxxxxxxxxx
 08/09/2004 09:06
 Please respond to
 aspectj-users@xxxxxxxxxxx


 To
 aspectj-users@xxxxxxxxxxx
 cc

 Subject
 [aspectj-users] Load time weaving with AspectJ?






 Hi,
 I've just read a message from Adrian Colyer in the dev-list about
 load-time weaving with AspectJ and I must confess I completely missed that

 feature!

 Is it in AspectJ since 1.2 version or 1.1?

 Can you give me some references about load-time weaving in AspectJ?
 I've found only Adrian's post here:
 http://www.freeroller.net/comments/colyer/Weblog/load_time_weaving_with_aspectj

 But nothing else.

 In particular I'd be very interested in learning how to use load-time
 weaving in a real J2ee environment (such as Websphere or other app server)

 Regards,

 Filippo Diotalevi


 ---
 Filippo Diotalevi
 http://www.jroller.com/page/fdiotalevi
 Scopri Mister Yahoo! - il fantatorneo sul calcio di Yahoo! Sport'

 _______________________________________________
 aspectj-users mailing list
 aspectj-users@xxxxxxxxxxx
 http://dev.eclipse.org/mailman/listinfo/aspectj-users


---
Filippo Diotalevi
http://www.jroller.com/page/fdiotalevi