Top Description Inners Constructors Methods
com.google.common.util.concurrent

public final Class UncaughtExceptionHandlers

extends Object
Class Inheritance
Annotations
@J2ktIncompatible
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Static Imports
java.util.logging.Level.SEVERE

Factories for UncaughtExceptionHandler instances.
Author
Gregory Kick
Since
8.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Thread.UncaughtExceptionHandler
systemExit()

Returns an exception handler that exits the system.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

UncaughtExceptionHandlersback to summary
private UncaughtExceptionHandlers()

Method Detail

systemExitback to summary
public static Thread.UncaughtExceptionHandler systemExit()

Returns an exception handler that exits the system. This is particularly useful for the main thread, which may start up other, non-daemon threads, but fail to fully initialize the application successfully.

Example usage:

public static void main(String[] args) {
  Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandlers.systemExit());
  ...

The returned handler logs any exception at severity SEVERE and then shuts down the process with an exit status of 1, indicating abnormal termination.

com.google.common.util.concurrent back to summary

pack-priv final Class UncaughtExceptionHandlers.Exiter

extends Object
implements UncaughtExceptionHandler
Class Inheritance
  • java.lang.Object
  • com.google.common.util.concurrent.UncaughtExceptionHandlers.Exiter
All Implemented Interfaces
java.lang.Thread.UncaughtExceptionHandler
Annotations
@VisibleForTesting

Field Summary

Modifier and TypeField and Description
private static final LazyLogger
private final Runtime

Constructor Summary

AccessConstructor and Description
pack-priv
Exiter(Runtime runtime)

Method Summary

Modifier and TypeMethod and Description
public void
uncaughtException(Thread
the thread
t
,
Throwable
the exception
e
)

Implements java.lang.Thread.UncaughtExceptionHandler.uncaughtException.

Method invoked when the given thread terminates due to the given uncaught exception.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final LazyLogger logger
runtimeback to summary
private final Runtime runtime

Constructor Detail

Exiterback to summary
pack-priv Exiter(Runtime runtime)

Method Detail

uncaughtExceptionback to summary
public void uncaughtException(Thread t, Throwable e)

Implements java.lang.Thread.UncaughtExceptionHandler.uncaughtException.

Doc from java.lang.Thread.UncaughtExceptionHandler.uncaughtException.

Method invoked when the given thread terminates due to the given uncaught exception.

Any exception thrown by this method will be ignored by the Java Virtual Machine.

Parameters
t:Thread

the thread

e:Throwable

the exception

Annotations
@Override