|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.errorhandling.ForeignExceptionDispatcher
@InterfaceAudience.Public @InterfaceStability.Evolving public class ForeignExceptionDispatcher
The dispatcher acts as the state holding entity for foreign error handling. The first exception received by the dispatcher get passed directly to the listeners. Subsequent exceptions are dropped.
If there are multiple dispatchers that are all in the same foreign exception monitoring group, ideally all these monitors are "peers" -- any error on one dispatcher should get propagated to all others (via rpc, or some other mechanism). Due to racing error conditions the exact reason for failure may be different on different peers, but the fact that they are in error state should eventually hold on all.
This is thread-safe and must be because this is expected to be used to propagate exceptions from foreign threads.
Field Summary | |
---|---|
protected List<ForeignExceptionListener> |
listeners
|
static org.apache.commons.logging.Log |
LOG
|
protected String |
name
|
Constructor Summary | |
---|---|
ForeignExceptionDispatcher()
|
|
ForeignExceptionDispatcher(String name)
|
Method Summary | |
---|---|
void |
addListener(ForeignExceptionListener errorable)
Listen for failures to a given process. |
ForeignException |
getException()
Get the value of the captured exception. |
String |
getName()
|
boolean |
hasException()
Non-exceptional form of ForeignExceptionSnare.rethrowException() . |
void |
receive(ForeignException e)
Receive a ForeignException. |
void |
rethrowException()
Rethrow an exception currently held by the ForeignExceptionSnare . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
protected final String name
protected final List<ForeignExceptionListener> listeners
Constructor Detail |
---|
public ForeignExceptionDispatcher(String name)
public ForeignExceptionDispatcher()
Method Detail |
---|
public String getName()
public void receive(ForeignException e)
ForeignExceptionListener
Implementers must ensure that this method is thread-safe.
receive
in interface ForeignExceptionListener
e
- exception causing the error. Implementations must accept and handle null here.public void rethrowException() throws ForeignException
ForeignExceptionSnare
ForeignExceptionSnare
. If there is
no exception this is a no-op
rethrowException
in interface ForeignExceptionSnare
ForeignException
- all exceptions from remote sources are procedure exceptionspublic boolean hasException()
ForeignExceptionSnare
ForeignExceptionSnare.rethrowException()
. Checks to see if any
process to which the exception checkers is bound has created an error that
would cause a failure.
hasException
in interface ForeignExceptionSnare
public ForeignException getException()
ForeignExceptionSnare
getException
in interface ForeignExceptionSnare
public void addListener(ForeignExceptionListener errorable)
errorable
- listener for the errors. may be null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |