• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using java.lang.instrument API  RSS feed

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to attach my code into a target running jvm using the java.lang.instrument API with the agentmain() method. What next should I do if I want to get hold of a reference to all the available non-system (java.*) Objects? Can I just do a search of all the threads available and follows the reference recursively starting from the thread objects?
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to me that it would be better for me to instrument the classes by Javassist and modify their constructors so that whenever a new instance of the target class is created it will add a reference of itself to a global static data structure. (rather than having me to searching thru all the object reference recursively)

Would there be any tutorial available on using Javassist to modify the constructor of a class?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!