com.fasterxml.clustermate.client.NodeFailure Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clustermate-client Show documentation
Show all versions of clustermate-client Show documentation
Building blocks for client libraries that access
ClusterMate-based service.
package com.fasterxml.clustermate.client;
import java.util.*;
/**
* Class that contains information about failure of an operation as it
* relates to call(s) to a single server node.
* Each instance contains at least one actual {@link CallFailure}.
*/
public class NodeFailure
{
protected final ClusterServerNode _server;
protected LinkedList _failures;
public NodeFailure(ClusterServerNode server, CallFailure firstFail)
{
_server = server;
_failures = new LinkedList();
_failures.add(firstFail);
}
public void addFailure(CallFailure fail) {
_failures.add(fail);
}
public ClusterServerNode getServer() { return _server; }
/**
* Returns number of attempts that were made before giving up
*/
public int getFailCount() { return _failures.size(); }
public CallFailure getFirstCallFailure() { return _failures.getFirst(); }
public CallFailure getLastCallFailure() { return _failures.getLast(); }
public Iterable getCallFailures() { return _failures; }
@Override
public String toString() {
return "[Node Failure: "+_failures.size()+" failed; first = "+getFirstCallFailure()+"]";
}
}