mardi 18 octobre 2016

JVM - get hold of instance of a class in a running (non-instrumented) session

I need to stop a process by invoking a particular method on an instance of a given class. The process has been running for a day, and if I shut it down hard, I lose a lot of work. Due to a bug in the API, the GUI is wrongly wired and doesn't call the correct stop function. I have an interactive Java (Scala) interpreter attached, so if I could get hold of the instance of the process, I could easily invoke the correct method.

I am not in a debugging session, there is no com.sun.jdi. I can see the instance in a stack trace dump, but StackTraceElement doesn't contain actual instances, just classes and line numbers.

Is there any way in a running session, without specific instrumentation, to get hold of that instance -- through its class, through a thread dump?





Aucun commentaire:

Enregistrer un commentaire