Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Garbage collection of aspect instances

Matthew,
 
Thank you for your kind response. 
 
About cflow and cflowbelow, I have another question:
In the Programming Guide (or the Developers Guide), I remember reading that cflow and cflowbelow are restricted to a single thread.
 
So, in the context of this program, 
 
aspect PCFAspect percflow(execution (A.methodA())) {
  // advices for some point cuts.. 
}
 
class A {
  void methodA() {
    doSomething1();
    Thread t = new Thread(new B(this));
    t.start();
    doSomething2();
  }
  // .. other methods exist so that there are no compilation errors.
} // end of class A
 
class B implements Runnable {
  A a;
  B{A ainstance) {
    this.a = ainstance;
  }
  public void run() {
    if (shouldCallMethodA()) a.methodA(); // <= Refered to below
    else a.doSomething3();
  }
  // .. other methods exist so that there are no compilation errors.
} // end of class B
 
Please validate these statements:
1. When the a.methodA() marked above is executed, the cflow of the (second) methodA() execution will instantiate a new aspect instance
2. The cflow picked out by cflow(execution (B.run())) is not within the cflow or cflowbelow of execution (A.methodA())
 
[Note: I have not compiled the above program.. I hope there are no material errors, and that my questions' intention is conveyed unambiguously. If not, please let me know..]
 
Thanks,
Balaji

----- Original Message ---- 
From: Matthew Webster <matthew_webster@xxxxxxxxxx> 
To: aspectj-users@xxxxxxxxxxx 
Sent: Friday, September 29, 2006 4:04:44 AM 
Subject: Re: [aspectj-users] Garbage collection of aspect instances 


Balaji, 

The statements are all correct without any qualifications. 

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/ 


G Balaji <gopinathanbalaji@xxxxxxxxx> 
Sent by: aspectj-users-bounces@xxxxxxxxxxx 
28/09/2006 19:34 Please respond to 
aspectj-users@xxxxxxxxxxx 

ToAspectJ User Mailing List <aspectj-users@xxxxxxxxxxx> 
cc 
Subject[aspectj-users] Garbage collection of aspect instances 







Dear AspectJ Users, 

Can the experts and/or knowledgeable people please validate these statements below: 
1. issingleton aspect instances are gc-ed(*) when the class loader that loaded the aspects is gc-ed. 
2. pertypewithin aspect instances are gc-ed when the class loader that loaded the types is gc-ed. 
3. perthis and pertarget aspect instances are gc-ed when this (or target) is gc-ed. 
4. percflow and percflowbelow aspect instances are gc-ed when the cflow (or cflowbelow) are complete 

(*) gc-ed => eligible for garbage collection. 

If these statements are generally correct, but are qualified in certain situations, I would be interested to know these situations too. 

Thanks, 
Balaji 
_______________________________________________ 
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