gently shutdown java process with "kill -15"

W

wurznsepp

hi everyone,

i can´t find a way to gently shutdown my java process,
when "kill -15 .." is signaled.
is there any api or system function that serve this kind
of message?

i tried to clean up in "finalize()", but this function
does not seem to be called after "kill -15".

my environment: hp-ux 11i, jdk 1.3.x

thanks in advance,

wurznsepp
 
C

Christophe Vanfleteren

wurznsepp said:
hi everyone,

i can´t find a way to gently shutdown my java process,
when "kill -15 .." is signaled.
is there any api or system function that serve this kind
of message?

i tried to clean up in "finalize()", but this function
does not seem to be called after "kill -15".

my environment: hp-ux 11i, jdk 1.3.x

thanks in advance,

wurznsepp

Try the following:

Runtime.getRuntime().addShutdownHook(new Thread(){
public void run() {
//do whatever you need to do if app shuts down
}
});
 
W

wurznsepp

thx, christophe!

it works!

:)))

Christophe Vanfleteren said:
Try the following:

Runtime.getRuntime().addShutdownHook(new Thread(){
public void run() {
//do whatever you need to do if app shuts down
}
});
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top