本文整理匯總了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);
}