Package akka.japi
Class Throwables
- java.lang.Object
-
- akka.japi.Throwables
-
public class Throwables extends java.lang.ObjectHelper class for determining whether aThrowableis fatal or not. User should only catch the non-fatal one,and keep rethrow the fatal one.Fatal errors are errors like
VirtualMachineError(for example,OutOfMemoryErrorandStackOverflowError, subclasses ofVirtualMachineError),ThreadDeath,LinkageError,InterruptedException,ControlThrowable.Note. this helper keep the same semantic with
NonFatalin Scala. For example, all harmlessThrowables can be caught by:try { // dangerous stuff } catch(Throwable e) { if (Throwables.isNonFatal(e)){ log.error(e, "Something not that bad."); } else { throw e; }
-
-
Constructor Summary
Constructors Constructor Description Throwables()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisFatal(java.lang.Throwable throwable)Returns true if the providedThrowableis to be considered fatal, or false if it is to be considered non-fatalstatic booleanisNonFatal(java.lang.Throwable throwable)Returns true if the providedThrowableis to be considered non-fatal, or false if it is to be considered fatal
-
-
-
Method Detail
-
isNonFatal
public static boolean isNonFatal(java.lang.Throwable throwable)
Returns true if the providedThrowableis to be considered non-fatal, or false if it is to be considered fatal
-
isFatal
public static boolean isFatal(java.lang.Throwable throwable)
Returns true if the providedThrowableis to be considered fatal, or false if it is to be considered non-fatal
-
-