-
1. Re: About Kill -3 signal
clebert.suconic Jun 20, 2007 11:22 AM (in response to yimianshisan)The signal is captured by the JVM, and there is a specific API for that signal on JVMPI.
I tried capturing signals on the native layer... but every time I tried breaking the regular flow of execution.... (JVM->NativeLayer) I got crashes.
The first version used only kill -3, later I developed a MBean where you could use Java->native methods to control its life cycle.
The best way to control the execution now would be through MBean.. but you need to have the jboss-profiler-noAOP.sar deployed before JBoss started. -
2. Re: About Kill -3 signal
yimianshisan Jun 21, 2007 3:40 AM (in response to yimianshisan)Thank you Clerbert!
I know the execution can be controlled by MBean well, it's really a better way.
But what I want to know is the principle of the signal handle. I have tried to define my own signal handling method in jbossInspector.cc. as following:
void signalStartProfiler(int signum)
{
if (profilerRunning>=0) {
initProfiler();
} else {
printMessageError();
}
}
and in the JVM_onLoad() method, I added the following code:
signal(SIGUSR1,signalStartProfiler);
Now I can send signal kill -10 to the process. the profiling now can be started, but the process is dead. When I delete the following code in method initProfile,every thing is OK.
if (profileMemory)
{
jvmpi_interface->DisableEvent(JVMPI_EVENT_OBJECT_ALLOC, NULL);
jvmpi_interface->DisableEvent(JVMPI_EVENT_OBJECT_FREE, NULL);
}
It is interesting, but I don't know why. when I define my own signal handle,what the JVM had done?