@InterfaceAudience.Private public class ForeignExceptionDispatcher extends Object implements ForeignExceptionListener, ForeignExceptionSnare
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.
| 限定符和类型 | 字段和说明 |
|---|---|
protected List<ForeignExceptionListener> |
listeners |
protected String |
name |
| 构造器和说明 |
|---|
ForeignExceptionDispatcher() |
ForeignExceptionDispatcher(String name) |
| 限定符和类型 | 方法和说明 |
|---|---|
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. |
protected final String name
protected final List<ForeignExceptionListener> listeners
public ForeignExceptionDispatcher(String name)
public ForeignExceptionDispatcher()
public String getName()
public void receive(ForeignException e)
ForeignExceptionListenerImplementers must ensure that this method is thread-safe.
receive 在接口中 ForeignExceptionListenere - exception causing the error. Implementations must accept and handle null here.public void rethrowException()
throws ForeignException
ForeignExceptionSnareForeignExceptionSnare. If there is
no exception this is a no-oprethrowException 在接口中 ForeignExceptionSnareForeignException - all exceptions from remote sources are procedure exceptionspublic boolean hasException()
ForeignExceptionSnareForeignExceptionSnare.rethrowException(). Checks to see if any
process to which the exception checkers is bound has created an error that
would cause a failure.hasException 在接口中 ForeignExceptionSnarepublic ForeignException getException()
ForeignExceptionSnaregetException 在接口中 ForeignExceptionSnarepublic void addListener(ForeignExceptionListener errorable)
errorable - listener for the errors. may be null.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.