public class ServerHealthState extends Object
| Constructor and Description |
|---|
ServerHealthState(URI server) |
ServerHealthState(URI server,
int minSamplesToReportError) |
ServerHealthState(URI server,
int maxSamplesStored,
int minSamplesToReportError) |
| Modifier and Type | Method and Description |
|---|---|
float |
getErrorPercentage(long nowMillis,
int timeRangeMillis) |
IOException |
getLastException() |
float |
getLastReportedErrorPercentage() |
long |
getLastReportedLatency() |
int |
getLastReportedSamples() |
long |
getPingLatencyMillis(long nowMillis,
int timeRangeMillis) |
int |
getPingLatencySampleCount() |
int |
getRequestSampleCount() |
URI |
getServer() |
void |
reportException(IOException exp) |
void |
reportPingLatency(long nowMillis,
long latencyMillis)
NOTE: Assumes nowMillis is roughly non-decreasing in consecutive calls.
|
void |
reportRequestError(long nowMillis)
NOTE: Assumes nowMillis is roughly non-decreasing in consecutive calls.
|
void |
reportRequestSuccess(long nowMillis)
NOTE: Assumes nowMillis is roughly non-decreasing in consecutive calls.
|
String |
toString(long nowMillis,
int timeRangeMillis) |
public ServerHealthState(URI server)
public ServerHealthState(URI server, int minSamplesToReportError)
public ServerHealthState(URI server, int maxSamplesStored, int minSamplesToReportError)
public void reportPingLatency(long nowMillis,
long latencyMillis)
nowMillis - latencyMillis - public void reportException(IOException exp)
public void reportRequestSuccess(long nowMillis)
nowMillis - public void reportRequestError(long nowMillis)
nowMillis - public int getPingLatencySampleCount()
public int getRequestSampleCount()
public float getErrorPercentage(long nowMillis,
int timeRangeMillis)
nowMillis - Current timestamp.timeRangeMillis - Time range for 'nowMillis' to compute the errorPercentage for.public URI getServer()
public long getPingLatencyMillis(long nowMillis,
int timeRangeMillis)
@Nullable public IOException getLastException()
public String toString(long nowMillis, int timeRangeMillis)
public float getLastReportedErrorPercentage()
public int getLastReportedSamples()
public long getLastReportedLatency()