Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] thisJoinPointStaticPart

You may cache and use thisJoinPoint long after the completion of corresponding advice. However, the objects returned by getThis(), getArgs() may have changed their value by the time you access it. In other words, thisJoinPoint holds onto join point context by reference and not by value. Further, such a scheme may end up holding onto objects that would otherwise be claimed by the garbage collector.

Bottom line: For flight recorder kind of application, holding onto thisJoinPoint is an unworkable solution.

-Ramnivas

Chandan, Savita wrote:
 Eric,

Would this also mean that I can cache thisJoinPoint in memory and then
use it later long after the advise is done?
Or 
should this be used within the scope of the advice?

I have attached the response I received earlier on this.

Thanks,
Savita



-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Eric Bodden
Sent: Tuesday, August 15, 2006 6:31 AM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] thisJoinPointStaticPart

Note that in such a situation it's no problem to capture the
"thisJoinPoint" object in the advice and then pass it to the method as
an argument.


Eric


  
-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-
bounces@xxxxxxxxxxx] On Behalf Of Conway. Fintan (IT Solutions)
Sent: Tuesday, August 15, 2006 5:56 AM
To: wes@xxxxxxxxxxxxxx; aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] thisJoinPointStaticPart

Doh,

Of course it is!  I was trying to use it in a method called from an
advice.

Sometimes it is the simple things that trip us up.

Many thanks,

Fintan

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Wes
Sent: 15 August 2006 09:58
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] thisJoinPointStaticPart


Hi -

this..JoinPoint.. reflective variables are only valid in the body of
advice, as discussed here:

http://www.eclipse.org/aspectj/doc/released/progguide/semantics-
advice.h
tml#reflective-access-to-the-join-point

thisJoinPoint{StaticPart} refers to the join point being advised, and
thisEnclosingJoinPointStaticPart refers to the join point enclosing
    
the
  
current one, if known.  They are of type JoinPoint or
JoinPoint.StaticPart.

Does that help? - wes


------------Original Message------------
From: "Conway. Fintan (IT Solutions)" <Fintan.Conway@xxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: Tue, Aug-15-2006 1:43 AM
Subject: [aspectj-users] thisJoinPointStaticPart Hi *,

I am trying to retrieve the method which is firing an advice.  I am
trying to use 'thisJoinPointStaticPart.toString()'.

When I type thisJoinPointStaticPart into Eclipse it shows up in bold
and purple - so far so good.  However when I save the aspect file,
Eclipse gives me the error - "
thisJoinPointStaticPart cannot be resolved" .  I have imported
org.aspectj.lang.*; I am using Eclipse 3.2 and AJDT 1.4. Any advice
(pun
intended) is appreciated, Regards, Fintan PS same problem for
thisJoinPoint.

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


* ** *** ** * ** *** ** * ** *** ** *
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed.
Any views or opinions presented are solely those of the author, and do
not necessarily  represent those of ESB.
If you have received this email in error please notify the sender.

Although ESB scans e-mail and attachments for viruses, it does not
guarantee that either are virus-free and accepts no liability for any
damage sustained as a result of viruses.

* ** *** ** * ** *** ** * ** *** ** *

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



Subject:
RE: [aspectj-users] AspectJ 1.5 runtime and compile time Performance
From:
"Matthew Webster" <matthew_webster@xxxxxxxxxx>
Date:
Tue, 8 Aug 2006 09:35:19 -0700
To:
<aspectj-users@xxxxxxxxxxx>
To:
<aspectj-users@xxxxxxxxxxx>

Savita, 

Now that I understand you are writing a flight recorder I agree that annotations are the best approach. However you will _not_ have to use reflection at runtime to capture parameters. Simply put the JoinPoint object (thisJoinPoint) in your circular buffer for before advice and the object obtained from "after () : returning(ret)" or "after() : throwing(th)" for after advice. When you encounter an error condition or some other trigger and need to dump the buffer use the appropriate methods: getSignature(), getThis(), getArgs(). Just beware that non-primitive parameters may change value after being recorded so you may need to us toString (expensive and unreliable), copy (very expensive) are record simple identity. Using AspectJ and matching on annotations will be much simpler that using APT. 

Cheers 

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/ 



"Chandan, Savita" <Savita.Chandan@xxxxxxxxxxxxxx> 
Sent by: aspectj-users-bounces@xxxxxxxxxxx 

07/08/2006 19:52 
Please respond to
aspectj-users@xxxxxxxxxxx

To
<aspectj-users@xxxxxxxxxxx> 
cc
Subject
RE: [aspectj-users] AspectJ 1.5 runtime and compile time Performance

	




Hi Mathew, 
  
Thanks Mathew, I did read your article and was hoping that there would be a sequel to the same with AspectJ1.5. 
  
The design is to log entry/exit of selected few methods that would help record the application footsteps. This would log to a circular buffer in the memory.  This is a flight recorder logging and is required to be on all the time. 
  
You are right sprinkling annotations all over the code might turn out to be a maintenance nightmare, but the scope of our annotations will be limited to certain classes and the idea here is that the developer ( end user) doesn't have to depend on whether we use AspectJ for our frame work or just generate code using apt and AnnotationProcessor. 
  
Iam new to AspectJ and will dig further into using pointcuts as opposed to annotations. But In my design I need to decide whether I will be using plain Annotations with apt and annotation processor or Aspect J and here the performance of the AspectJ during runtime seemed to be of concern coz we will have to use reflection to log the parameters. 
  
Savita 


________________________________

From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Matthew Webster
Sent: Monday, August 07, 2006 1:33 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] AspectJ 1.5 runtime and compile time Performance


In the past we have done a lot of performance measurement (http://ducati.doc.ntu.ac.uk/uksim/journal/Vol-6/No.3-4/CRC-Dalton.pdf), especially for a logging aspect because of the scope of interaction with the application, which have resulted in implementation improvements and new compiler features e.g. -XlazyTjp. Unfortunately this work has not been updated for AspectJ 1.5 but there shouldn't have been any substantial change in performance in this particular area. However, there have been improvements to the AspectJ runtime WRT heap usage which may have a knock-on effect indirectly through reduced GC. 

In my experience logging (by which I mean recording or tracing entry and exit, optionally with arguments, for a large proportion of methods in a large proportion of classes in an application) is disabled for 99% of the time. This is because the pathlength of  recording the information to disk or even memory in text or binary form has an unacceptable impact on overall application throughput and is reserved for problem diagnosis. It is therefore the performance of the system with logging disabled that is important. A well designed logging aspect should not need to use reflection: using thisJoinPoint and thisJoinPointStaticPart do not. Please see Chapter 11 of "Eclipse AspectJ" for an example of best practice. 

I'd like to ask some questions about your design. How do you propose to use annotations? Annotating a large proportion of the methods in your system will create a new maintenance problem: much better to use a traditional pointcut  that matches using types and method names while perhaps excluding certain frequently called methods, that will flood the log with superfluous information, using an annotation that is used at weave- not run-time. 

A well written logging aspect should have similar performance characteristics to a hand written equivalent but be less invasive, more flexible and guaranteed to produce correct data. 

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/ 


"Chandan, Savita" <Savita.Chandan@xxxxxxxxxxxxxx> 
Sent by: aspectj-users-bounces@xxxxxxxxxxx 

04/08/2006 20:49 

Please respond to
aspectj-users@xxxxxxxxxxx



To
<aspectj-users@xxxxxxxxxxx> 
cc
Subject
[aspectj-users] AspectJ 1.5 runtime and compile time  Performance


	





Hi All, 

Iam looking into a design where one of the options is to use AspectJ with Annotations for adding a logging concern. The concern I have is regarding the runtime performance hit this would have due to the usage of reflection in the aspects. The requirement of my design is to log the parameters as well as the annotated method and the class it belongs to. There would be restrictions on how many parameters would be logged and stuff. 

Does anybody have any links to the benchmarking data on Java1.5, Windows OS, using AspetcJ1.5? 

Thanks, 
sc 

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


  

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

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

Back to the top