Here is problem I have main game thread and using JFrame
JFrame on setVisible create not daemon Thread AWT-EventQueue
So when my main process Thread do all work,
and I don’t have other no deamon thread Application still running
To finish it need or hide JFrame or use System.exit
The problem in error Exception,
The standard way is surround main function
try{}catch or finally
But I need debug in Eclipse start Exception and try{} block skip it.
For fix error in debug mode.
So we need make some action on Exception not using try{}
Here is my solution
Closer Thread something similar like base JVM Check for no daemon
public class Closer_Thread extends Thread{
public Closer_Thread(){
super();
setDaemon(true);
setName("Closer");
setPriority(Thread.MIN_PRIORITY);
}
@Override
public void run(){
while(true){
try{
sleep(1000);// every sec
}catch (InterruptedException e){
e.printStackTrace();
}
//Start.Game_Thread my main Procces Thread
if(!Start.Game_Thread.isAlive()){
/*finalize_Ap(){
etc(); // my case stop server client - send exit packets
System.Exit(0);
}*/
Start.finalize_Ap();
}
}
}
}