public abstract class HostMonitorConnectionContext extends java.lang.Object implements ConnectionContext
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.atomic.AtomicReference<java.lang.ref.WeakReference<java.sql.Connection>> |
connectionToAbortRef |
protected java.util.concurrent.atomic.AtomicBoolean |
nodeUnhealthy |
| Constructor and Description |
|---|
HostMonitorConnectionContext() |
| Modifier and Type | Method and Description |
|---|---|
@Nullable java.sql.Connection |
getConnection()
Get the connection associated with this context.
|
boolean |
isActive()
Check if this context is currently active.
|
boolean |
isNodeUnhealthy()
Check if the database node is unhealthy.
|
void |
setInactive()
Mark this context as inactive and release any connection references.
|
void |
setNodeUnhealthy(boolean nodeUnhealthy)
Set the health status of the database node.
|
boolean |
shouldAbort()
Check if the connection should be aborted due to node failure.
|
protected final java.util.concurrent.atomic.AtomicReference<java.lang.ref.WeakReference<java.sql.Connection>> connectionToAbortRef
protected final java.util.concurrent.atomic.AtomicBoolean nodeUnhealthy
public boolean isNodeUnhealthy()
ConnectionContextisNodeUnhealthy in interface ConnectionContextpublic void setNodeUnhealthy(boolean nodeUnhealthy)
ConnectionContextsetNodeUnhealthy in interface ConnectionContextnodeUnhealthy - true if the node is unhealthy, false otherwisepublic void setInactive()
ConnectionContextsetInactive in interface ConnectionContextpublic @Nullable java.sql.Connection getConnection()
ConnectionContextgetConnection in interface ConnectionContextpublic boolean isActive()
ConnectionContextisActive in interface ConnectionContextpublic boolean shouldAbort()
ConnectionContextshouldAbort in interface ConnectionContext