Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] perJoinPoint

For what's it's worth, you were able to implement this capability by writing
an ITD on StaticPart, and weaving that into aspectjrt.jar

I like your proposal Ramnivas to add user objects for tracking information
per join point. The biggest question is how does it scale when multiple
aspects want to store state per join point/static part. But if you want to
modularize the state that different aspects track per join point/static
part, you can write a skeleton UserObject class and then have each aspect
write Inter-Type Declarations to add their own private state to track on
it...

-----Original Message-----
From: aspectj-dev-admin@xxxxxxxxxxx [mailto:aspectj-dev-admin@xxxxxxxxxxx]
On Behalf Of Ramnivas Laddad
Sent: Thursday, March 24, 2005 9:24 AM
To: aspectj-dev@xxxxxxxxxxx
Subject: Re: [aspectj-dev] perJoinPoint

I too have come across the same need. In my case, I wanted to store 
profile information per-join point (static part).
While using hashmaps works, it is inefficient in many situations.

A form of per-association will work (and JBoss AOP has such aspect 
association)
Actually, there may be need for two kinds of associations: 
perJoinPointStaticPart and perJoinPoint.
While these new  aspect associations might work, I have a simpler 
proposal to address the need.
I will like to add the following APIs:

    void JoinPoint.StaticPart.setUserObject(Object)
    Object JoinPoint.StaticPart.getUserObject()

And, for symmetry,

    void JoinPoint.setUserObject(Object)
    Object JoinPoint.getUserObject()

Then I will be able to store profile information as follows:

Object around() : profiled() {
    long startTime = getTime();
    Object ret = proceed();
    long endTime = getTime();

    ProfileInfo jpStats = 
(ProfileInfo)thisJoinPointStaticPart.getUserObject();
    if(jpStats == null) {
        thisJoinPointStaticPart.setUserObject(new ProfileInfo());
    }
    jpStats.record(endTime-startTime);
}

Just submitted an enhancement request:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=89009

-Ramnivas

Eric Bodden wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>No, this is not easily possible at the moment (see the perobjects
>discussion we had earlier). One workaround would be to store the
>joinpoint-specifc state in a hashmap. I think you can even use an
>identity hashmap, since joinpoints are pooled IIRC.
>
>Of course for large problems you might accumulate quite a lot of
>state over the runtime. But this is more a general problem rather
>than specific to AspectJ.
>
>Eric
>
>- --
>Eric Bodden
>Chair I2 for Programming Languages and Program Analysis
>RWTH Aachen University
>
>
>
>________________________________
>
>From: aspectj-dev-admin@xxxxxxxxxxx
>[mailto:aspectj-dev-admin@xxxxxxxxxxx] On Behalf Of Tavoda Pavel
>Sent: Donnerstag, 24. März 2005 11:58
>To: aspectj-dev@xxxxxxxxxxx
>Subject: [aspectj-dev] perJoinPoint
>
>
>Is it possible to achieve something like perJoinPoint aspect?
>I would like to calculate some statistics for method execution.
>
>TNX
>
>Pavel
>
>-----BEGIN PGP SIGNATURE-----
>Version: PGP 8.0.3
>
>iQA/AwUBQkKl7MwiFCm7RlWCEQL2gACfRjf4bEHO5IKGHTID3EZeQwi1chMAoJOW
>ps0sDujWkuwzpDLcv0SMvf1T
>=rpcS
>-----END PGP SIGNATURE-----
>
>
>
>_______________________________________________
>aspectj-dev mailing list
>aspectj-dev@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>  
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev



Back to the top