本文整理汇总了Java中java.lang.Thread.UncaughtExceptionHandler.uncaughtException方法的典型用法代码示例。如果您正苦于以下问题:Java UncaughtExceptionHandler.uncaughtException方法的具体用法?Java UncaughtExceptionHandler.uncaughtException怎么用?Java UncaughtExceptionHandler.uncaughtException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.Thread.UncaughtExceptionHandler
的用法示例。
在下文中一共展示了UncaughtExceptionHandler.uncaughtException方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: uncaughtException
import java.lang.Thread.UncaughtExceptionHandler; //导入方法依赖的package包/类
@Override
public void uncaughtException(Thread t, Throwable e) {
if (!(e instanceof ThreadDeath)) {
UncaughtExceptionHandler h = Thread.getDefaultUncaughtExceptionHandler();
if (h != null) {
h.uncaughtException(t, e);
return;
}
if (e instanceof VirtualMachineError) {
// Try as hard as possible to get a stack trace from e.g. StackOverflowError
e.printStackTrace();
}
System.err.flush();
Exceptions.printStackTrace(e);
}
else {
super.uncaughtException(t, e);
}
}
示例2: run
import java.lang.Thread.UncaughtExceptionHandler; //导入方法依赖的package包/类
@Override
public final void run()
{
try
{
_r.run();
}
catch (Throwable e)
{
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
示例3: handleExceptionInternal
import java.lang.Thread.UncaughtExceptionHandler; //导入方法依赖的package包/类
private void handleExceptionInternal(Throwable e) {
UncaughtExceptionHandler exceptionHandler;
exceptionHandler = getExceptionHandler();
try {
if (exceptionHandler != null) {
exceptionHandler.uncaughtException(Thread.currentThread(), e);
}
} finally {
handleException(e);
}
}
示例4: uncaughtException
import java.lang.Thread.UncaughtExceptionHandler; //导入方法依赖的package包/类
@Override
public void uncaughtException(Thread t, Throwable e) {
UncaughtExceptionHandler delegate;
synchronized (this) {
delegate = exceptionHandler;
}
if (delegate != null) {
delegate.uncaughtException(t, e);
}
}
示例5: a
import java.lang.Thread.UncaughtExceptionHandler; //导入方法依赖的package包/类
private void a(Thread thread, Throwable th) {
for (UncaughtExceptionHandler uncaughtException : c()) {
try {
uncaughtException.uncaughtException(thread, th);
} catch (Throwable th2) {
}
}
}
示例6: uncaught
import java.lang.Thread.UncaughtExceptionHandler; //导入方法依赖的package包/类
static void uncaught(@NonNull Throwable error) {
Thread currentThread = Thread.currentThread();
UncaughtExceptionHandler handler = currentThread.getUncaughtExceptionHandler();
handler.uncaughtException(currentThread, error);
}