This isn't really a servlet question.
 
So far as I know, there's no portable way to establish a signal handler in Java, probably because signals themselves aren't entirely portable across all platforms.
 
What you'd need to do is create a native process (using C or C++, most likely) that sets up the signal handler, then uses JNI Invocation to create the Java VM within your native process and loads and executes the Java class desired. Or, alternatively, use JNI to call out to a C/C++ routine that does the signal-handler setup to call back into a C/C++ routine that then, in turn, uses JNI to call back into your Java code. Either way, it's not precisely trivial.
 
<SHAMELESS PLUG>
I've done this, though, for the Win32 platform, as an example of JNI in the book I've got coming down the pike (Dec 99, I think). Email me privately (to reduce the bandwidth on the list) if you want/need to know more.
</SHAMELESS PLUG>
 
Ted Neward
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward
 "I don't even speak for myself; my wife won't let me." --Me
-----Original Message-----
From: Nicolas Germain <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, June 29, 1999 6:13 AM
Subject: Catch the control-c in a java console application

Is it possible to catch the ^C sequence to perform
clean-up before the termination of a java     application ?
 
Thanks
 
--
Nicolas Germain
Akazi Technologies
 

Reply via email to