public interface MonitoringConnectionHandler extends StateSnapshotProvider
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptConnection(java.sql.Connection conn,
boolean isWriter,
HostSpec hostSpec)
Called when a connection is offered to the handler (e.g., a writer connection found during panic mode).
|
@Nullable HostSpec |
acceptConnections(java.util.Map<HostSpec,AtomicConnection> connections,
@Nullable HostSpec writerHostSpec,
@Nullable java.util.List<HostSpec> topology)
Offers a batch of harvested connections (e.g., from node monitoring threads after panic mode resolves)
to the handler.
|
void |
attemptConnectionUpgrade(java.util.List<HostSpec> currentTopology)
Non-blocking attempt to upgrade the monitoring connection to a higher-priority node.
|
void |
close()
Cleans up resources: cancels pending upgrade attempts and closes any connections held by the handler.
|
getSnapshotStateboolean acceptConnection(java.sql.Connection conn,
boolean isWriter,
HostSpec hostSpec)
conn - the offered connectionisWriter - true if the connection is to a writer instancehostSpec - the host spec of the connection@Nullable HostSpec acceptConnections(java.util.Map<HostSpec,AtomicConnection> connections, @Nullable HostSpec writerHostSpec, @Nullable java.util.List<HostSpec> topology)
The handler determines each connection's role from the topology (the writer host is known) — readers are everything else. The handler may also use the host's region for region-aware priorities.
connections - a map of host -> connection harvested from node threadswriterHostSpec - the host spec of the writer (if known)topology - the current topology, used for region/role contextvoid attemptConnectionUpgrade(java.util.List<HostSpec> currentTopology)
currentTopology - the current cluster topologyvoid close()