Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Post-compile Weaving Vs Load-time Weaving

LTW can also be beneficial if you want to weave into code that you
don't own and perhaps don't even know which jar it resides in.

F.e. weave into all subtypes of JDBC's PreparedStatement. You might
not know which JDBC driver will be used at deployment time. If you use
LTW, this won't be any problem but when the right class is loaded then
it is woven transparently.

/Jonas

On 11/8/06, Matthew Webster <matthew_webster@xxxxxxxxxx> wrote:

Virender,

I would add another item to Adrian's list:
* you don't own or control the aspects you are using and want to allow them and your application to evolve independently without the need to rebuild and redeploy your application. In some ways a woven application becomes a blob a bit like an (old fashioned) .exe file. If an aspect changes it may no longer be binary compatible with your application or may rely on new cross-cutting behaviour that was not implemented when originally woven. Yes you will need to retest the application but not rebuild it. You may like to look at the Aspects Equinox Incubator (http://www.eclipse.org/equinox/incubator/aspects/getting_started.php211) where we are looking at this whole issue by exploiting OSGi dependencies and versioning.

As well as being a little old (pre-AspectJ5) the article you refer to is perhaps not the best guide to choosing LTW over another weaving phase in that it is making the case for built-in JVM aspect weaving. I support this effort in the long run but even if implemented in the JVM aspect weaving will still incur an overhead both in footprint and pathlength. You must therefore select LTW for the same reason you choose late binding and even JIT compilation in Java: flexibility and portability.

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@xxxxxx.com212
 http://w3.hursley.ibm.com/~websterm/213



 Adrian Colyer <adrian.colyer@gmail.com214>
Sent by: aspectj-users-bounces@eclipse.org215

08/11/2006 10:11

Please respond to
 aspectj-users@eclipse.org216


To aspectj-users@eclipse.org217

cc


Subject Re: [aspectj-users] Post-compile Weaving Vs Load-time Weaving








In general you build an application once, and run it many times. Load-time weaving means you pay the cost of weaving every time your application launches. If you do post-compile time weaving as part of your build process, then there will be no overhead at runtime and your application will start faster and use less memory. So I would always opt for post-compile time weaving unless:

* you need the flexibility of changing the set of aspects you are using from run to run
* you are using the aspects for temporary instrumentation (e.g. using Glassbox) - this is really a special case of the above
* you just want to try things out quickly and don't want the hassle of changing your build process

Load-time weaving can also sometimes be beneficial in speeding up certain development scenarios. In general however, why do at runtime what you could easily have done ahead of time...

Regards, Adrian.


On 8 Nov 2006, at 10:00, virendersingh@xxxxxxx.in218 wrote:


 Hi,

 I was analysing whether one should go for Post-compile weaving or Load-time weaving. I read on the bea site (http://dev2dev.bea.com/pub/a/2005/08/jvm_aop_1.html219) that Load-time weaving (using agents) affects both scalability and usability. Are these issues of scalability and usability applicable to post-compile weaving as well?

 Any help on the technical advantage of one over another would be highly appreciated.

 Thanks,
 Virender Singh,
 Consulting and Architecture Team,
 HSBC GLT, Pune , India


 ************************************************************
 HSBC Software Development (India) Pvt Ltd
 HSBC Center Riverside,West Avenue ,
 25 B Kalyani Nagar Pune  411 006 INDIA

 Telephone: +91 20 26683000
 Fax: +91 20 26681030
 ************************************************************

 ________________________________





 *******************************************************************
 This e-mail is confidential. It may also be legally privileged.
 If you are not the addressee you may not copy, forward, disclose
 or use any part of it. If you have received this message in error,
 please delete it and all copies from your system and notify the
 sender immediately by return e-mail.

 Internet communications cannot be guaranteed to be timely,
 secure, error or virus-free. The sender does not accept liability
 for any errors or omissions.
 *******************************************************************
 "SAVE PAPER - THINK BEFORE YOU PRINT!"
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org220
https://dev.eclipse.org/mailman/listinfo/aspectj-users221
_______________________________________________
 aspectj-users mailing list
 aspectj-users@eclipse.org222
 https://dev.eclipse.org/mailman/listinfo/aspectj-users223


_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org224
https://dev.eclipse.org/mailman/listinfo/aspectj-users225






--
Jonas Bonér

http://jonasboner.com

Back to the top