public class MonitorConnectionContext
extends java.lang.Object
Constructor and Description |
---|
MonitorConnectionContext(JdbcConnection connectionToAbort,
java.util.Set<java.lang.String> nodeKeys,
Log log,
int failureDetectionTimeMillis,
int failureDetectionIntervalMillis,
int failureDetectionCount)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getFailureCount() |
int |
getFailureDetectionCount() |
int |
getFailureDetectionIntervalMillis() |
int |
getFailureDetectionTimeMillis() |
long |
getInvalidNodeStartTime() |
void |
invalidate() |
boolean |
isActiveContext() |
boolean |
isNodeUnhealthy() |
void |
updateConnectionStatus(long statusCheckStartTime,
long currentTime,
boolean isValid)
Update whether the connection is still valid if the total elapsed time has passed the
grace period.
|
public MonitorConnectionContext(JdbcConnection connectionToAbort, java.util.Set<java.lang.String> nodeKeys, Log log, int failureDetectionTimeMillis, int failureDetectionIntervalMillis, int failureDetectionCount)
connectionToAbort
- A reference to the connection associated with this context
that will be aborted in case of server failure.nodeKeys
- All valid references to the server.log
- A Log
implementation.failureDetectionTimeMillis
- Grace period after which node monitoring starts.failureDetectionIntervalMillis
- Interval between each failed connection check.failureDetectionCount
- Number of failed connection checks before considering
database node as unhealthy.public int getFailureDetectionTimeMillis()
public int getFailureDetectionIntervalMillis()
public int getFailureDetectionCount()
public int getFailureCount()
public long getInvalidNodeStartTime()
public boolean isNodeUnhealthy()
public boolean isActiveContext()
public void invalidate()
public void updateConnectionStatus(long statusCheckStartTime, long currentTime, boolean isValid)
statusCheckStartTime
- The time when connection status check started in milliseconds.currentTime
- The time when connection status check ended in milliseconds.isValid
- Whether the connection is valid.