|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FailureDetector
The FailureDetector API is used to determine a cluster's node availability. Machines and servers can go down at any time and usage of this API can be used by request routing in an attempt to avoid unavailable servers.
A FailureDetector is specific to a given cluster and as such there should only be one instance per cluster per JVM. Implementations can differ dramatically in how they approach the problem of determining node availability. Some implementations may rely heavily on invocations of recordException and recordSuccess to determine availability. The result is that such a FailureDetector implementation performs little logic other than bookkeeping, implicitly trusting users of the API. However, other implementations may be more selective in using results of any external users' calls to the recordException and recordSuccess methods. Implementations may use these error/success calls as "hints" or may ignore them outright. To contrast the two approaches to implementing:
RoutedStore| Method Summary | |
|---|---|
void |
addFailureDetectorListener(FailureDetectorListener failureDetectorListener)
Adds a FailureDetectorListener instance that can receive event callbacks about node availability state changes. |
void |
destroy()
Cleans up any open resources in preparation for shutdown. |
int |
getAvailableNodeCount()
Returns the number of nodes that are considered to be available at the time of calling. |
FailureDetectorConfig |
getConfig()
Retrieves the FailureDetectorConfig instance with which this FailureDetector was constructed. |
long |
getLastChecked(Node node)
Returns the number of milliseconds since the node was last checked for availability. |
int |
getNodeCount()
Returns the number of nodes that are in the set of all nodes at the time of calling. |
boolean |
isAvailable(Node node)
Determines if the node is available or offline. |
void |
recordException(Node node,
long requestTime,
UnreachableStoreException e)
Allows external callers to provide input to the FailureDetector that an error occurred when trying to access the node. |
void |
recordSuccess(Node node,
long requestTime)
Allows external callers to provide input to the FailureDetector that an access to the node succeeded. |
void |
removeFailureDetectorListener(FailureDetectorListener failureDetectorListener)
Removes a FailureDetectorListener instance from the event listener list. |
void |
waitForAvailability(Node node)
waitForAvailability causes the calling thread to block until the given Node is available. |
| Method Detail |
|---|
boolean isAvailable(Node node)
node - Node to check
long getLastChecked(Node node)
node - Node to check
void recordSuccess(Node node,
long requestTime)
node - Node to checkrequestTime - Length of time (in milliseconds) to perform request
void recordException(Node node,
long requestTime,
UnreachableStoreException e)
node - Node to checkrequestTime - Length of time (in milliseconds) to perform requeste - Exception that occurred when trying to access the nodevoid addFailureDetectorListener(FailureDetectorListener failureDetectorListener)
failureDetectorListener - FailureDetectorListener that receives
eventsremoveFailureDetectorListener(voldemort.cluster.failuredetector.FailureDetectorListener)void removeFailureDetectorListener(FailureDetectorListener failureDetectorListener)
failureDetectorListener - FailureDetectorListener that was receiving
eventsaddFailureDetectorListener(voldemort.cluster.failuredetector.FailureDetectorListener)FailureDetectorConfig getConfig()
int getAvailableNodeCount()
n = the results of
getNodeCount(), the return value is bounded in the range
[0..n].
getNodeCount()int getNodeCount()
getAvailableNodeCount()
void waitForAvailability(Node node)
throws java.lang.InterruptedException
node - Node on which to wait
java.lang.InterruptedException - Thrown if the thread is interruptedvoid destroy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||