|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@InterfaceAudience.Private public interface ForeignExceptionSnare
This is an interface for a cooperative exception throwing mechanism. Implementations are containers that holds an exception from a separate thread. This can be used to receive exceptions from 'foreign' threads or from separate 'foreign' processes.
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.
Method Summary | |
---|---|
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 . |
Method Detail |
---|
void rethrowException() throws ForeignException
ForeignExceptionSnare
. If there is
no exception this is a no-op
ForeignException
- 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |