Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > gently shutdown java process with "kill -15"

Reply
Thread Tools

gently shutdown java process with "kill -15"

 
 
wurznsepp
Guest
Posts: n/a
 
      01-26-2004
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
 
Reply With Quote
 
 
 
 
Christophe Vanfleteren
Guest
Posts: n/a
 
      01-26-2004
wurznsepp wrote:

> 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
}
});

--
Kind regards,
Christophe Vanfleteren
 
Reply With Quote
 
 
 
 
wurznsepp
Guest
Posts: n/a
 
      01-26-2004
thx, christophe!

it works!

))

Christophe Vanfleteren <(E-Mail Removed)> wrote in message news:<m77Rb.6064$(E-Mail Removed)-ops.be>...
> wurznsepp wrote:
>
> > 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
> }
> });

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
intercept shutdown of a IIS garden process to terminate a bkgd thr =?Utf-8?B?QmVubnk=?= ASP .Net 5 05-01-2006 01:02 AM
computer reboots during shutdown process Mark Computer Support 3 07-20-2005 02:16 AM
Gateway 450RGH Troubles at Fingerprint Sensor and Shutdown Process open@to.707.to Computer Support 1 02-10-2005 02:24 PM
Can't shutdown without Ending unnamed process Bryan McCaul Computer Support 3 09-20-2004 10:08 PM
Shutdown a single ASP.net process. Robert May ASP .Net 1 10-19-2003 04:58 AM



Advertisments