Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10719

Re: System.exit

From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
Newsgroups comp.lang.java.programmer
Subject Re: System.exit
References <9d7fe75jrjv74ksjprrmdca7mp8hb0sflh@4ax.com> <slrnjefi0u.fvg.avl@gamma.logic.tuwien.ac.at> <6ssfe7dm5tnets3pgkvm5l7k5slotcbef2@4ax.com> <jc8sjn$ccl$1@dont-email.me>
Message-ID <yiTFq.18143$2e7.17922@newsfe18.iad> (permalink)
Date 2011-12-13 17:51 -0800

Show all headers | View raw


On 12/13/11 5:02 PM, Eric Sosman wrote:
> On 12/13/2011 7:53 PM, Roedy Green wrote:
>> On 13 Dec 2011 21:48:15 GMT, Andreas Leitgeb
>> <avl@gamma.logic.tuwien.ac.at> wrote, quoted or indirectly quoted
>> someone who said :
>>
>>>
>>> Are you sure you really do System.exit()
>>
>> I do a real system exit.
>
> SSCCE?
>
pittsdosx:noisebridge pittsd$ cat ExitTest.java
public class ExitTest {
    public static void main(String...args) throws Exception {
      new Thread(new Runnable() {
         public void run() {
            while(true) {
              System.out.println("In thread!");
              try {
               Thread.sleep(250);
              } catch (Exception e) {
                e.printStackTrace();
              }
           }
        }}).start();

      Thread.sleep(2000);
      System.out.println("Before exit!");
      try {
        System.exit(-1);
      } finally { System.out.println("Finally!"); }
    }
}
pittsdosx:noisebridge pittsd$ javac ExitTest.java
pittsdosx:noisebridge pittsd$ java ExitTest
In thread!
In thread!
In thread!
In thread!
In thread!
In thread!
In thread!
In thread!
Before exit!
In thread!

I see no evidence that the thread continues after System.exit() is 
finished executing.

Granted, I do see a slight delay, probably due to thread scheduling, 
that my log message for the "before exit" isn't the last thing output.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

System.exit Roedy Green <see_website@mindprod.com.invalid> - 2011-12-13 10:48 -0800
  Re: System.exit Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-13 14:59 -0500
  Re: System.exit Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-12-13 21:48 +0000
    Re: System.exit Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-12-13 14:14 -0800
      Re: System.exit Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-12-14 00:01 +0000
        Re: System.exit markspace <-@.> - 2011-12-13 16:03 -0800
          Re: System.exit Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-12-14 00:13 +0000
    Re: System.exit Roedy Green <see_website@mindprod.com.invalid> - 2011-12-13 16:53 -0800
      Re: System.exit Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-13 20:02 -0500
        Re: System.exit Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-12-13 17:51 -0800
        Re: System.exit Roedy Green <see_website@mindprod.com.invalid> - 2011-12-14 09:38 -0800
  Re: System.exit Paul Cager <paul.cager@googlemail.com> - 2011-12-14 02:09 -0800

csiph-web