Interface UncaughtExceptionHandler
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface UncaughtExceptionHandlerModeled after Thread#UncaughtExceptionHandler Install an implementation of this via the provided install() method, to receive a notification when any exception is thrown by any method in the DiSCo reflect APIs. Without such a handler installed, all exceptions - even unchecked ones - will be suppressed
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidhandleUncaughtException(ReflectiveCall call, java.lang.Object[] args, java.lang.Throwable t)Receive any exception thrown as part of calling a DiSCo agent method.static voidinstall(UncaughtExceptionHandler handler)Helper method to install an instance of an UncaughtExceptionHandler.
-
-
-
Method Detail
-
handleUncaughtException
void handleUncaughtException(ReflectiveCall call, java.lang.Object[] args, java.lang.Throwable t)
Receive any exception thrown as part of calling a DiSCo agent method. In an agent-not-present scenario, calls via the reflect APIs will always be safe If an agent is not present, Exceptions will be dispatched to the UncaughtExceptionHandle if they are produced as a result of invalid arguments/inputs. e.g. when passing a reserved identifier as a key to TransactionContext methods. If an Agent is present, the underlying 'real' method calls may throw exceptions of their own, which will be dispatched by the same mechanism. If client code requires the exception to bubble up into their code, rethrow any RuntimeException with the supplied exception as its inner cause e.g. InvocationTargetException, or any exception which makes sense to the client application.- Parameters:
call- the call which caused the errorargs- the arguments passed to the call which produced the errort- the exception/error thrown during execution of an Agent method call.
-
install
static void install(UncaughtExceptionHandler handler)
Helper method to install an instance of an UncaughtExceptionHandler.- Parameters:
handler- the handler to install, or null to clear a previously installed handler.
-
-