I don't whether this question fits in this category. If not, I am sorry. But if you can help me, that would be great.
I am doing a project where I need to monitor the communication between two objects during runtime. I mean I should log the method calls to/by an object during runtime. The constrain is that I should not change the code of either objects. So, if you guys know any articles/papers/projects where I can find some information, please let me know.
Thanks for your reply. I am already looking into JVMTI. I will try the other one too. But I want to make my question clear. I don't need to monitor the entry and exit to a method. I want to know which methods of an object [say objA] are being called and the methods called by this object[objA]. I just need to log these method calls.
None of them are easy alternatives. Sure, JVMTI will solve your purpose, but if speed is not an issue, I would suggest an "all java" alternative using spring interceptors. They will use byte code instrumentation at runtime (invisible to you) but what you want to do will literally be a piece of cake with spring interceptors. Ofcourse, your objects will all have to be spring beans.
Look into some spring / AOP tutorials on how to do this. A simple google search and you will have what you need.