In my pet project i have a long running job, i want to show the status to the user about the process and how far it went. So am pushing the status objects to JMS topic from there am picking up the and feeding to WS app to stream them to a valid client. I have written point cuts in spring AOP(namely @Before, @AfterReturn) and calling my service to send the message to topic. Now i want to log the status of the service not on the method start or after return inside the method also. So i called the service(which has jmsTamplete injected and took status object). Is there any way to minimize these calls so that i can not repeat the service calls. here is my sudo code.
public class Myservice{
UserDao userDao;
LegService legservice;
ProviderDao providerDao;
....
StatusServive statusServie;
//aop will call the same service to send info to JMS topic
fetchandCalculateLeg(){
// here i called statusServie.senStatus(StatusObject);
List<Users> = userDao.fetchUserInfo();
// here i called statusServie.senStatus(StatusObject);
....
loop: #forEachUser
// here i called statusServie.senStatus(StatusObject);
someList = legservice.fecthLegInfoForEachUser();
// here i called statusServie.senStatus(StatusObject);
:endloop;
....
} }
At present i have 3 long running tasks, and i am calling the same in each and every method class. i want to minimize calls.
EDIT1: I can apply AOP on the calling methods too, but what is the performance in this case? How to measure the AOP performance(how much memory it consumed during application Up or to create proxy objects). Sorry for asking so many questions.