Attach Api and agent unloading

Ishaaq Chandy ishaaq at gmail.com
Thu Oct 15 01:26:44 UTC 2009


Hi all,
Not sure if this is the right forum to ask this, if you know of a more
appropriate one please direct me there.

I am using the awesome Attach API
http://java.sun.com/javase/6/docs/jdk/api/attach/spec/index.html to attach
an java-based agent to a running app. All working perfectly, great API!

Now, I want to know if there is a way to "unattach" the agent. i.e., does
the agent run in a child classloader that can be unloaded on demand thus
freeing up any resources the agent was using?

What I'm trying to get to is an attaching tool that can be run on demand to
attach to a production app - do whatever it needs to do and then clean up
after itself - i.e. stop any new threads it started, close all resources,
unload any new classes it may have loaded up, free up memory it was using
etc, so that the production app can continue running at normal operation
mode, almost as if we never attached to it in the first place. Obviously,
there can be caveats here - if the attached code is written in such a way
that makes it impossible for the classloader to release the classes for GC
then all bets are off.

Looking at the API, it looks like this is not possible, but I just thought
I'd ask on the offchance I am missing something  here.

Thanks,
Ishaaq
-- 
View this message in context: http://www.nabble.com/Attach-Api-and-agent-unloading-tp25900852p25900852.html
Sent from the OpenJDK General discussion mailing list archive at Nabble.com.




More information about the discuss mailing list