Re: [aspectwerkz-user] Weaving aspects into abstract class initialisation
Alexandru Popescu <[email protected]> Fri, 27 May 2005 14:57:44 +0200
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
#: on behalf of Bygrave, Graham BGI UK :: 5/27/2005 12:31 PM :# > A polymorphic call to my subclass class (i.e. prior to the jump table finding the base method). > Sorry I don't get this: A.method() B extends A if B doesn't override A.method than A.method is called if B overrides A.method than B.method is called. so in your scenario there is no way to do it ;-). :alex |.::the_mindstorm::.| > -----Original Message----- > From: Alexandru Popescu [mailto:[email protected]] > Sent: 27 May 2005 12:01 > To: [email protected] > Subject: Re: [aspectwerkz-user] Weaving aspects into abstract class > initialisation > > > #: on behalf of Bygrave, Graham BGI UK :: 5/27/2005 11:11 AM :# >> If I don't weave java.lang.Object (I don't want to do this), will the aspect be triggered if I don't override finalize in my own (woven) class? > > How should this happen? > 1/ Object.finalize is not weaved (cause you didn't do it) > 2/ YourObject does not define a finalize > > What should trigger the weaved code? > > :alex |.::the_mindstorm::.| > >> >> Thanks, >> Graham. >> >> >> -----Original Message----- >> From: Alexandre Vasseur [mailto:[email protected]] >> Sent: 27 May 2005 10:09 >> To: [email protected] >> Subject: Re: [aspectwerkz-user] Weaving aspects into abstract class >> initialisation >> >> >> Graham >> >> You can write: execution(* java.lang.Object+.finalize()) to match on >> overrided finalize() methods execution in your own class (note the "+" >> sign) >> >> Alex >> >> On 5/27/05, Bygrave, Graham BGI UK <[email protected]> wrote: >>> Thanks for your reply. >>> Does ltw mean Load time weaving? I'm implementing an object counter for both war and ejb jar classes, as we seem to be leaking memory somewhere. Not too keen on load time weaving as this would be slower and require an appserver restart. >>> >>> Indeed I'm using a mix of finalize for non entity bean classes and unset entity context for entity beans (don't have session beans). >>> >>> The primary thing I note (was another question to the list) was that methods don't get woven polymorphically (i.e. aspects don't get called for methods not actually implemented in the target class). This is obviously a problem when calling finalize, as it's not overridden in most of our classes, which just defer to java.lang.Object. >>> >>> At the moment, I'm using a perl script to modify the code prior to compile and this seems to work quite well. Obviously and aspect oriented solution would be preferable though. >>> >>> Best wishes, >>> Graham. >>> >>> -----Original Message----- >>> From: Alexandru Popescu [mailto:[email protected]] >>> Sent: 26 May 2005 19:12 >>> To: [email protected] >>> Subject: Re: [aspectwerkz-user] Weaving aspects into abstract class >>> initialisation >>> >>> >>> #: on behalf of Bygrave, Graham BGI UK :: 5/24/2005 3:35 PM :# >>> > Hi, >>> > >>> > I want to build compile an aspect into a web application using the offline approach. As the actual EJBs are generated on deploy, I can't weave my aspect into them. So as a cludge fix, I want to weave my aspect into abstract class intialisations/finalisations instead. Is there currently any way to do this in the existing pointcut syntax? >>> > >>> > Best wishes, >>> > Graham. >>> > >>> > >>> >>> Hi Graham, >>> >>> I am not sure i am getting some of the above explanations: >>> 1/ why not consider the ltw? >>> 2/ what EJBs get generated at deploy? (what are you really trying to advice?) >>> 3/ staticinitialization pointcut definition is meant for static initialization, as for finalization >>> what do you mean by this? (the normal finalize() or the EJB lifecycle?) >>> >>> >>> cheers, >>> :alex |.::the_mindstorm::.| >>> >> > >