[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [aspectj-users] looking for a "magic" pointcut for ...
- From: "Dehua Zhang" <dehua.zhang@xxxxxxxxxxxxxx>
- Date: Tue, 13 Nov 2007 16:51:05 -0500
- Delivered-to: email@example.com
- Thread-index: Acgke0dUJUiFuegWQQiRm4bm8/2A3ABxALqa
- Thread-topic: [aspectj-users] looking for a "magic" pointcut for ...
use PhantomReferences to determine exactly when an object was removed from memory
Dehua (Andy) Zhang
Sable Research Group, McGill University
Montréal, Québec, Canada
From: aspectj-users-bounces@xxxxxxxxxxx on behalf of Eric Bodden
Sent: Sun 11/11/2007 10:55
Subject: Re: [aspectj-users] looking for a "magic" pointcut for ...
You could probably build one on your own via testing a weak reference
in an if-pointcut. However, you would need to poll this reference over
and over again. I don't think there's any way to have the garbage
collector call you when an object is GC'ed. Having said that, you
*could* probably attach an advice to the finalize() method, but as the
documentation says, finalizers are not guaranteed to be run, or if
they are run you get no guarantee about when or in which order. They
may even run in parallel, if I remember correctly.
On 11/11/2007, Jean-Louis.Pasturel <jean-louis.pasturel@xxxxxxxxx> wrote:
> Is there a "magic" pointcut for detecting when an object :
> - is finalized or this object is no more referenced ( object=null ;) ?
> - is garbagged ?
> Is-it only possible with AspectJ ?
> Best Regards
> aspectj-users mailing list
Sable Research Group
McGill University, Montréal, Canada
aspectj-users mailing list