使用ThreadGroup来处理异常
来源:互联网 发布:网络女主播私下贩毒 编辑:程序博客网 时间:2024/05/17 01:42
public class ApplicationLoader extends ThreadGroup
{
private ApplicationLoader()
{
super("ApplicationLoader");
}
public static void main(String[] args)
{
Runnable appStarter = new Runnable()
{
public void run()
{
// invoke your application
// (i.e. MySystem.main(args)
System.out.println("ssss");
// throw new NullPointerException();
throw new Error("sssdsds");
}
};
new Thread(new ApplicationLoader(), appStarter).start();
}
// We overload this method from our parent
// ThreadGroup , which will make sure that it
// gets called when it needs to be. This is
// where the magic occurs.
public void uncaughtException(Thread thread, Throwable exception)
{
// Handle the error/exception.
// Typical operations might be displaying a
// useful dialog, writing to an event log, etc.
exception.printStackTrace();
}
}
这个是一个很好的异常处理机制。main中所有的错误都会转到uncaughtException方法中处理
- 使用ThreadGroup来处理异常
- Windows使用筛选器来处理异常
- ThreadGroup线程组使用
- ThreadGroup
- ThreadGroup
- JavaScript可以使用try...catch来进行异常处理
- JavaScript可以使用try...catch来进行异常处理
- Android中使用UncaughtExceptionHandler来处理未捕获的异常
- ThreadGroup与ExecutorService的使用
- 使用ThreadGroup模拟线程池
- 使用ThreadGroup模拟线程池
- 使用 Application_Error 处理异常
- 异常处理的使用:
- 使用异常处理错误
- 使用SpringAOP 处理异常
- 使用Stacktrace处理异常
- 使用slf4j来打印异常
- 使用lldb来处理以下三种场景: 死循环、异常断点、多线程
- Metasploit 3 - Automating Meterpreter for Client-Side Exploits
- 老`新无敌`隐身代码和改死亡模式
- PHP 编程标准
- Install vncserver (as root) on U-NAS (loongson)
- List box的使用
- 使用ThreadGroup来处理异常
- 一个封锁操作被对WSACancelBlockingCall的调用中断
- 未完成的DNF外挂代码。
- 有关指针的小程序
- DNF免CD代码
- DNF修武器代码
- Commands out of sync; you can't run this command now
- test
- Debug U-boot with BDI2000