|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.cluster.failuredetector.AbstractFailureDetector
public abstract class AbstractFailureDetector
AbstractFailureDetector serves as a building block for FailureDetector implementations.
Field Summary | |
---|---|
protected FailureDetectorConfig |
failureDetectorConfig
|
protected java.util.Map<java.lang.Integer,voldemort.cluster.failuredetector.NodeStatus> |
idNodeStatusMap
|
protected java.util.concurrent.ConcurrentHashMap<FailureDetectorListener,java.lang.Object> |
listeners
|
protected org.apache.log4j.Logger |
logger
|
Constructor Summary | |
---|---|
protected |
AbstractFailureDetector(FailureDetectorConfig failureDetectorConfig)
|
Method Summary | |
---|---|
void |
addFailureDetectorListener(FailureDetectorListener failureDetectorListener)
Adds a FailureDetectorListener instance that can receive event callbacks about node availability state changes. |
protected void |
checkArgs(Node node,
long requestTime)
|
protected void |
checkNodeArg(Node node)
|
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. |
java.lang.String |
getAvailableNodes()
|
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. |
protected voldemort.cluster.failuredetector.NodeStatus |
getNodeStatus(Node node)
|
java.lang.String |
getUnavailableNodes()
|
void |
removeFailureDetectorListener(FailureDetectorListener failureDetectorListener)
Removes a FailureDetectorListener instance from the event listener list. |
protected void |
setAvailable(Node node)
|
protected void |
setUnavailable(Node node,
UnreachableStoreException e)
|
void |
waitForAvailability(Node node)
waitForAvailability causes the calling thread to block until the given Node is available. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface voldemort.cluster.failuredetector.FailureDetector |
---|
isAvailable, recordException, recordSuccess |
Field Detail |
---|
protected final FailureDetectorConfig failureDetectorConfig
protected final java.util.concurrent.ConcurrentHashMap<FailureDetectorListener,java.lang.Object> listeners
protected final java.util.Map<java.lang.Integer,voldemort.cluster.failuredetector.NodeStatus> idNodeStatusMap
protected final org.apache.log4j.Logger logger
Constructor Detail |
---|
protected AbstractFailureDetector(FailureDetectorConfig failureDetectorConfig)
Method Detail |
---|
public void addFailureDetectorListener(FailureDetectorListener failureDetectorListener)
FailureDetector
addFailureDetectorListener
in interface FailureDetector
failureDetectorListener
- FailureDetectorListener that receives
eventsFailureDetector.removeFailureDetectorListener(voldemort.cluster.failuredetector.FailureDetectorListener)
public void removeFailureDetectorListener(FailureDetectorListener failureDetectorListener)
FailureDetector
removeFailureDetectorListener
in interface FailureDetector
failureDetectorListener
- FailureDetectorListener that was receiving
eventsFailureDetector.addFailureDetectorListener(voldemort.cluster.failuredetector.FailureDetectorListener)
public FailureDetectorConfig getConfig()
FailureDetector
getConfig
in interface FailureDetector
public java.lang.String getAvailableNodes()
public java.lang.String getUnavailableNodes()
public int getAvailableNodeCount()
FailureDetector
n
= the results of
getNodeCount()
, the return value is bounded in the range
[0..n]
.
getAvailableNodeCount
in interface FailureDetector
FailureDetector.getNodeCount()
public int getNodeCount()
FailureDetector
getNodeCount
in interface FailureDetector
FailureDetector.getAvailableNodeCount()
public void waitForAvailability(Node node) throws java.lang.InterruptedException
FailureDetector
waitForAvailability
in interface FailureDetector
node
- Node on which to wait
java.lang.InterruptedException
- Thrown if the thread is interruptedpublic long getLastChecked(Node node)
FailureDetector
getLastChecked
in interface FailureDetector
node
- Node to check
public void destroy()
FailureDetector
destroy
in interface FailureDetector
protected void setAvailable(Node node)
protected void setUnavailable(Node node, UnreachableStoreException e)
protected voldemort.cluster.failuredetector.NodeStatus getNodeStatus(Node node)
protected void checkNodeArg(Node node)
protected void checkArgs(Node node, long requestTime)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |