aspose file tools*
The moose likes Threads and Synchronization and the fly likes SOPs are getting even after System exit code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "SOPs are getting even after System exit code" Watch "SOPs are getting even after System exit code" New topic
Author

SOPs are getting even after System exit code

buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

I realized that in Threading , even after System.exit(0) , I am getting some SOPs . How is it possible ?
M K Rayapudi
Ranch Hand

Joined: Feb 19, 2007
Posts: 157
means, your main thread/method is completing its job,
but, other threads are running.


R6i
buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

Actually before Threading , I used to know that after calling System.exit(0) , the program stops to work and exits and even after reading the System.exit(0) , I am getting SOPs means still some thread is running . So in this point I am getting confused like how I am getting SOPs after System.exit(0) , is it like even after System.exit command , the compiler does not shut down the code if in case any other threads is still have the value.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

System.exit() begins the 'normal shutdown' procedure which includes executing shutdown hooks and finalizers. If any of these hooks/finalizers call System.out.println() then the output may be recorded. Also, and especially of you have a lot of output statements in a tight loop, the output to System.out.println() is buffered which means the output may be stored for a brief time before being sent to the console. So if you shutdown that output stream is generally flushed and any stored output would be pushed to the console.


Steve
buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

THANKS TO ALL
 
Don't get me started about those stupid light bulbs.
 
subject: SOPs are getting even after System exit code