@InterfaceAudience.Private public interface ForeignExceptionSnare
To use, one would pass an implementation of this object to a long running method and
periodically check by calling rethrowException()
. If any foreign exceptions have
been received, the calling thread is then responsible for handling the rethrown exception.
One could use the boolean hasException()
to determine if there is an exceptoin as well.
NOTE: This is very similar to the InterruptedException/interrupt/interrupted pattern. There, the notification state is bound to a Thread. Using this, applications receive Exceptions in the snare. The snare is referenced and checked by multiple threads which enables exception notification in all the involved threads/processes.
Modifier and Type | Method and Description |
---|---|
ForeignException |
getException()
Get the value of the captured exception.
|
boolean |
hasException()
Non-exceptional form of
rethrowException() . |
void |
rethrowException()
Rethrow an exception currently held by the
ForeignExceptionSnare . |
void rethrowException() throws ForeignException
ForeignExceptionSnare
. If there is
no exception this is a no-opForeignException
- all exceptions from remote sources are procedure exceptionsboolean hasException()
rethrowException()
. Checks to see if any
process to which the exception checkers is bound has created an error that
would cause a failure.ForeignException getException()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.