My intention is identifying the OutOfMemory exception cases even before occuring.
Most of the times the generated heapdump shows collection classes such as hashmap or arraylist with 80% of heap occupation.
So if we identify such objects with collection size crosses a threshold of 100 or say. I want the information to be logged.
While logging the information, i want to print the corresponding object name in the logger.
Currently i am making use of only file and line number for this purpose.
Thanks,
Krishnachaitanya Jasty
Tata Consultancy Services
Mailto:
krishna.jasty@xxxxxxxWebsite:
http://www.tcs.com____________________________________________
Experience certainty. IT Services
Business Solutions
Consulting
____________________________________________
To: "aspectj-users@xxxxxxxxxxx" <aspectj-users@xxxxxxxxxxx>
From: Alexander Kriegisch
Sent by: aspectj-users-bounces@xxxxxxxxxxx
Date: 07/03/2013 03:23PM
Subject: Re: [aspectj-users] Fw: aspectj capturing currently executing object
Hi Krishna.
Your questions indicate you want to do some kind of run-time analysis, logging, monitoring or debugging. This assumption is speculative though. Anyway, I have a feeling that maybe what you are trying to do might be overkill or at least suboptimal. If you could describe your goal or intent a bit to us, maybe we could suggest a simpler or more elegant way to solve your problem. For instance, I cannot imagine why you would need the source code during runtime. In your earlier example I also thought that you could work with argument binding via this(), target() and args() instead of creating arrays and iterating over them if just your pointcuts were a bit smarter or more precise.
Bottom line: AspectJ is for adding cross-cutting behaviour to your application. What kind of behaviour do you want?
Kind regards
--
Alexander Kriegisch
Unfortunately the source code line is not captured in the joinpoint object, nor is the entire source encoded in the class file so that the relevant snippet could be extracted at runtime. You'd have to read the relevant source file and pull out the text you need.
cheers,
Andy