Skip to main content

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

--- "Enrique J. Amodeo Rubio" <eamodeorubio@xxxxxxxxxxxxxx> wrote:
> Hi, I have a doubt about the exact meaning of the perthis keyword. I 
> have read the docs several times and I'm unable to clarify my
> question.
> 
> I understand that when the pointcut defined inside perthis is
> reached, 
> then an aspect instance is created and associated with the current
> this 
> object. If it already exists an aspect instance of the same class 
> associated with that object then no new instance of the aspect is 
> created. Is this OK?

Correct.

> 
> My problem is that I don't know when the aspect instance is
> destroyed. 
> Does anybody know it ? I have two ideas:
> 
> a) Is destroyed when the pointcut is not active again.
> b) Is destroyed when the object is garbage collected.

b, the aspect instance is a candidate for garbage collection 
when the object is garbage collected (unless you are holding
a strong reference to the aspect instance, obtained using
aspectOf(Object), elsewhere).

> 
> Can anyone help me?
> 
> Enrique Amodeo


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/


Back to the top