[JAVA] ThreadDeath에 관한 질문입니다 ~
걸때
2023.04.01
stop()메소드가 호출 되는경우 쓰레드데스 exception이 발생하는데요 그래서
예외처리를 해주지 않습니까 ~
예외를 다시 throw? 이거 왜해주는 건지 궁금합니다 ~
try{
while(true){
Thread.sleep(500);
System.out.println(worker.getName()+ 일하는중 );
}
}
catch(InterruptedException e){
System.out.println(e);
}
catch(ThreadDeath ouch){
System.out.println(종료합니다);
throw(ouch); //이부분 말입니당 ~
}
-
민서
JavaDoc 말씀하시길..
If ThreadDeath is caught by a method, it is important that it be rethrown so that the thread actually dies.