Re: CVS: plexus-container-new/src/aspect/org/apache/plexus ComponentLeakAspect.java,NONE,1.1

Jason van Zyl <[email protected]> 25 May 2003 21:22:14 -0400
Newsgroups gmane.comp.java.plexus.devel
Organization Zenplex
Message-ID <[email protected]>
On Sun, 2003-05-25 at 16:57, [email protected] wrote:
> Update of /cvsroot/plexus/plexus-container-new/src/aspect/org/apache/plexus
> In directory eng.werken.com:/tmp/cvs-serv2742/src/aspect/org/apache/plexus
> 
> Added Files:
> 	ComponentLeakAspect.java 
> Log Message:
> Adding an aspect that can be used to track down "component leaks".  When
> I built poolserver, I didn't realize that Summit was actually using some
> components without ever releasing them.  As a result, after a week, I
> saw memory usage going through the roof.
> 
> Based on that experience, coupled with my desire to learn some AspectJ,
> I thought this would be an ideal opportunity.  To use the aspect:
> 
>   - Build a plexus jar as follows: maven aspectj:compile jar:install
>   - Add the aspectj dependency to your project.xml file
>   - Run your project
> 
> Here is the type of output you will receive if you have no component
> leaks (demo with a simple plexus command line application):
> 
>     kaz@coco:~/work/src/simple/target$ java -jar simple-1.0-uber.jar
>     Hello World!
>     >> Non-Released Component Count: 0
> 
> On the other hand, if you have a leak, you will see the following:
> 
>     kaz@coco:~/work/src/simple/target$ java -jar simple-1.0-uber.jar
>     Hello World!
>     >> Non-Released Component Count: 1
>     >>>> org.apache.plexus.examples.simple.DefaultHelloWorld@34a1fc
> 

Cool man!

This is exactly the kind of stuff we could put in a library of aspects
to help with container development! Very nice!

Anything is possible really. Reusable profiling aspects, and tracing
aspects for development type stuff. Bridges for security systems up to
things like transparent distributed containers!

Cool beans!

> -- 
> jvz.
> 
> Jason van Zyl
> [email protected]
> http://tambora.zenplex.org
> 
> In short, man creates for himself a new religion of a rational
> and technical order to justify his work and to be justified in it.
>   
>   -- Jacques Ellul, The Technological Society