Results 1 to 4 of 4
  1. #1
    paritoshcg is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Default killing a java process

    when we kill a java process using kill -9 ,it gets killed instantaneously ..... How does JVM handles this SIGKILL?

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    System.exit(0);
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    neilcoffey is offline Senior Member
    Join Date
    Nov 2008
    Posts
    286
    Rep Power
    7

    Default

    Nicholas -- is this true? As far as I'm aware SIGKILL causes an abrupt shutdown, so things like shutdown hooks and finalizers won't get run. (This is also how Goetz et al, p. 164, appear to describe things.)

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    With a kill -9 shutdown hooks, and the like, will not be executed. With a "normal" kill, SIGTERM, they do.

    @OP: It's easy to test, write a program that does nothing but sleep, and give it a shutdown hook that simply prints a message, then kill it.

Similar Threads

  1. Process running or not
    By smartsubroto in forum New To Java
    Replies: 4
    Last Post: 11-16-2009, 04:09 AM
  2. Killing an Ill-behaved Thread
    By John6715 in forum Threads and Synchronization
    Replies: 6
    Last Post: 10-03-2008, 09:35 AM
  3. Thread killing
    By denis in forum Threads and Synchronization
    Replies: 13
    Last Post: 09-25-2008, 10:28 PM
  4. Replies: 1
    Last Post: 08-03-2007, 07:17 PM
  5. Linux process from java
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 06:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •