On Tue, Jun 08, 1999 at 11:28:55AM +0000, Jonas Holmberg wrote:
> How can I make a method being called before the jvm exits when killing
> the jvm (or pressing Ctrl-C if its in the foreground)?
> 
> I suppose a pure java way is out of the question? What is the least OS
> dependant way?
> 
> What I want is to do some cleanup before stopping a server written in
> java only. And it must perform the cleanup if the computer is shut down,
> i.e. when the jvm is killed.
> 
> Thanks for a great mailing list!
> /Jonas Holmberg, Forget-it AB
>
i am using JavaSignals available on the blackdown site at
http://www.blackdown.org/java-linux/otherproducts.html
that is poiting to the site:
http://interstice.com/~kevinh/projects/javasignals/

it is working fine with me, but i'm afraid it is platform dependant as i
don't have a clue wether other OS that are not UNIX have signals...
you can basicly catch any signals but like all UNIX programs (i think)
you cannot catch a SIGKILL (9) because the process is supposed to have
received a SIGTERM (15?) before.
any proper shutdown script should kill its processes with that signal
then only after: SIGKILL.
shutting down apache works that way.

small problem however, the signal must be sent to the right thread... i
had a problem with that but can't remember where.
C-c from keyboard worked though. SIGINT i think.
it IS working and easy to use, my thanx to the author :)


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to