gently shutdown java process with "kill -15"

Discussion in 'Java' started by wurznsepp, Jan 26, 2004.

  1. wurznsepp

    wurznsepp Guest

    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
    wurznsepp, Jan 26, 2004
    #1
    1. Advertising

  2. 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
    Christophe Vanfleteren, Jan 26, 2004
    #2
    1. Advertising

  3. wurznsepp

    wurznsepp Guest

    thx, christophe!

    it works!

    :)))

    Christophe Vanfleteren <> wrote in message news:<m77Rb.6064$-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
    > }
    > });
    wurznsepp, Jan 26, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert May

    Shutdown a single ASP.net process.

    Robert May, Oct 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    361
    Alvin Bruney
    Oct 19, 2003
  2. Dave
    Replies:
    0
    Views:
    886
  3. julia
    Replies:
    6
    Views:
    453
    Sudsy
    Oct 19, 2004
  4. =?Utf-8?B?QmVubnk=?=
    Replies:
    5
    Views:
    642
    Steven Cheng[MSFT]
    May 1, 2006
  5. Mixedmingle
    Replies:
    0
    Views:
    793
    Mixedmingle
    Jan 23, 2009
Loading...

Share This Page