The addShutdownHook method of Runtime class is vervy useful to invoke something before a application exit. In addition coding in JUnit, very useful. 
If you create and use some Threads,  you can not invoke directly, this method usage is very helpful. 

public class Monitor {
private static Log log = LogFactory.getLog(HTMLPageFetcher.class);

private static NotificationCollector notiCollector;
static {
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
public static void close() {"close application.!!");


Posted by 김용환 '김용환'

댓글을 달아 주세요