jvm hotspot - execute new java code in existing jvm process -


I have a Java process that is currently running under a windows shell.

The thread responsible for serialization is blocked indefinitely and as a result important information stored in memory is no longer being written on disk.

If I close this process, the information will be lost.

If I can write and compile some new code and execute it in the same memory space, then before that I told the serial before I stopped the shutdown process. can go.

Code> Java-Player command

With Hotspot VM features, is there any way to achieve this?

You can use to attach to virtual machines.

Here is an example of a code:

  string agent jar = "myAgent.jar"; VirtualMochine VM = VirtualMatchin.Tatch (Processed); Vm.loadAgent (agentJAR);  

Where is the name of your jar?

The agent is the one in the jar, which can interface with JVM using the instrumentation API.

To create an agent that loads at runtime, you can implement the agentmain function like this:

 < Code> Public Static Zero Agent (String Agent Agents, Instrumentation Inst.);  

or

  public static zero agent (string agent agents);  

The object is used to modify the classes at runtime, which you probably do not need but hopefully put whatever code you need to run in the agentman And then attach the API to run it in target JVM.

Good luck!


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -