public class Host extends java.lang.Object implements HostStats
errorWaitTime milliseconds| Modifier and Type | Field and Description |
|---|---|
protected long |
consecutiveErrors |
static int |
DEFAULT_ERROR_WAIT_MS |
protected int |
errorWaitTime |
protected long |
lastConnectionTime |
protected long |
lastLogTime |
static int |
LOG_DELAY |
static int |
MAX_COOL_DOWN_EXP |
protected int |
openConnections |
protected long |
totalConnections |
protected long |
totalErrors |
| Constructor and Description |
|---|
Host(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
callComplete(boolean isError) |
void |
connectionClosed() |
void |
connectionOpened() |
boolean |
equals(java.lang.Object o) |
long |
getConsecutiveErrors() |
int |
getErrorWaitTime() |
java.util.Date |
getLastConnectionTime() |
java.lang.String |
getName() |
int |
getOpenConnections() |
long |
getResponseIndex() |
long |
getTotalConnections() |
long |
getTotalErrors() |
int |
hashCode() |
boolean |
isHealthy() |
void |
resetStats()
Resets historical metrics.
|
void |
setErrorWaitTime(int errorWaitTime)
Sets the number of milliseconds that should pass after an error has occurred before anyone should use this host.
|
void |
setHealthy(boolean healthy) |
java.lang.String |
toString() |
Host |
withErrorWaitTime(int errorWaitTime) |
public static final int DEFAULT_ERROR_WAIT_MS
public static final int LOG_DELAY
public static final int MAX_COOL_DOWN_EXP
protected int errorWaitTime
protected int openConnections
protected long lastConnectionTime
protected long totalConnections
protected long totalErrors
protected long consecutiveErrors
protected long lastLogTime
public Host(java.lang.String name)
name - the host name or IP address of this hostpublic void connectionOpened()
public void connectionClosed()
public void callComplete(boolean isError)
public java.lang.String getName()
public boolean isHealthy()
public void setHealthy(boolean healthy)
public long getResponseIndex()
public void resetStats()
public long getTotalConnections()
getTotalConnections in interface HostStatspublic long getTotalErrors()
getTotalErrors in interface HostStatspublic int getOpenConnections()
getOpenConnections in interface HostStatspublic java.util.Date getLastConnectionTime()
getLastConnectionTime in interface HostStatspublic long getConsecutiveErrors()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int getErrorWaitTime()
public void setErrorWaitTime(int errorWaitTime)
public Host withErrorWaitTime(int errorWaitTime)