Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] JoinPoint SourceLocation vs. Stack Trace Interigation


Gregory,

As with any performance concern the best course of action is to devise a benchmark, protoype your system and measure it. If the performance is acceptable then you never need worry about how parts of it you didn't write actually work (do you know how the JVM works?). If on the other hand performance is not acceptable then please use this list to either seek advice on language usage or even report a bug.

Some other things that you might like to know:
- If you use thisJoinPoint within a piece of advice to access only static information e.g. source location then the compiler will automatically substitute thisJoinPointStaticPart instead
- If you use thisJoinPointStaticPart then no object will be created after the initialization of you program (unlike Exception.getStackTrace() which creates many objects whose GC may severely affect performance)
- AspectJ generates all the static information needed for thisJoinPointStaticPart when it weaves you class

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/



Gregory Kedge <greg@xxxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

03/09/2006 19:08

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
Re: [aspectj-users] JoinPoint SourceLocation vs. Stack Trace        Interigation





>> Prior to JoinPoint, I was unaware of any other Java mechanism to
>> obtain file location information beyond the stack trace.
>
> The stack trace gets the file location information from attributes in
> the .class file put there by ... the compiler.  The source location
> is generated staticly by the compiler at compile-time so there is *no*
> cost to generate it at run time.

I knew that, but I don't know how to obtain that information out  
the .class file other than using the very expensive (as Eric AND I  
made point of) stack trace.  And I still don't know how  
JoinPoint.StaticPart populates its data... But I think you are  
inferring is that whatever AspectJ is doing to obtain the  
JoinPoint.StaticPart data, they are not using a stack trace to obtain  
that data.  Cool.  Is my assumption correct that the  
JoinPoint.StaticPart is populated whether I use it in the advice or  
not?  [I have looked at the source in CVS online and have only  
ferreted out JoinPoint interfaces, not the implementations...]

> As for generating stack traces, Eric Bodden already stated that it
> was one of the most expensive operations in Java (no less so of late),
> as you can imagine if you think about it.

I know its expensive. I promise I won't use it. I will use  
JoinPoint.Static.  How does JoinPoint.StaticPart extricate the class  
data to populate it?

>> Sorry if I am over obsessing on this but, asking helps me learn AND
>> move on... :-}
>
> Two (very smart) people replied with the answer to your original  
> question
> within 45 minutes (I love this list...).

That was indeed impressive.

>   But then it seems you didn't try or
> research their answers to validate them for yourself.  Their  
> answers were terse
> because this question is one that one can teach oneself by reading the
> documentation (I hate this list...).

I have poured over the documentation. All I can say at this point is  
that it is a slog. I finally came up with a crosscutting problem to  
solve as a conduit to learning and appreciating AOP.  So, I am doing  
this without an AOP course or having purchased the dated AspectJ in  
Action. I am starting from the premise that annotation style using  
the LTW will work best for me to debug with while using a non-Eclipse  
IDE to learn/develop.  So, non-annotations references that may better  
elucidate fundamental AOP principles make the mapping to annotations  
a challenge.

> I'm glad to see folks using annotation style.  I realize the docs  
> and the
> implementation aren't entirely tailored for that style, so any  
> feedback
> you have there can help us make it easier for folks who come after  
> you.

If Ramnivas L. is the be-end-all of writing for the beginner, light a  
fire under he and his publisher to update ApectJ in Action using  
annotations.  In lieu of that happening soonish, the only document  
that I can find that is annotations specific quick5.pdf that is  
included in the download jar.  Any recommendation on a more pervasive  
reference, please offer.  Google is only coming up with small one  
time examples showing the "possibilities" and http://www.eclipse.org/
aspectj/doc/released/adk15notebook/ doesn't do it for me...

> Their answers were terse because this question is one that one can  
> teach oneself
>  by reading the documentation (I hate this list...).
> ...
> I'm glad to see folks using annotation style.  I realize the docs  
> and the
> implementation aren't entirely tailored for that style,

Tough list. :-\

>
> Thanks -
> Wes

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


Back to the top