Up to now I used my application as a stand alone product. So, when user pressed "Stop" button I called System.exit(0);
and it was fine.
Now my application will be called (in a programmatic way) from another program. So, I afraid that System.exit(0);
will kill not only my process but also the external software which started my program.
So, what is the correct way to shutdown my application if a corresponding request from an external software is received? My application is an GUI application. So, I want to close the window but I also want to close all processes performed by my program.
ADDED:
To be more specific, I want to close all threads started by my program. My program does not start any OS process or any other program.