public class EndpointReaderResolver extends java.lang.Object implements ReaderResolver
ReaderResolver that connects to the configured read endpoint, optionally verifying the
connection role. Ports the legacy SimpleReadWriteSplittingPlugin.initializeReaderConnection.
Fails fast at construction if the endpoint is missing/blank.| Constructor and Description |
|---|
EndpointReaderResolver(java.lang.String readEndpoint,
boolean verifyNewConnections,
EndpointConnectionVerifier verifier) |
EndpointReaderResolver(java.lang.String readEndpoint,
boolean verifyNewConnections,
EndpointConnectionVerifier verifier,
boolean queryLevelLoadBalancing) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isPerQuery()
Whether this resolver performs query-level load balancing (a fresh reader is selected on each
read-routing decision rather than a single sticky reader being reused).
|
void |
switchToReader(RwSplitContext ctx)
Establishes a fresh reader connection (selecting a candidate, connecting, binding, and
switching the current connection to it).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseStaleReaderIfNecessarypublic EndpointReaderResolver(java.lang.String readEndpoint,
boolean verifyNewConnections,
EndpointConnectionVerifier verifier)
public EndpointReaderResolver(java.lang.String readEndpoint,
boolean verifyNewConnections,
EndpointConnectionVerifier verifier,
boolean queryLevelLoadBalancing)
public boolean isPerQuery()
ReaderResolverfalse keeps the sticky-reader behavior.isPerQuery in interface ReaderResolvertrue for per-query reader balancing; false (default) for stickypublic void switchToReader(RwSplitContext ctx) throws java.sql.SQLException
ReaderResolverinitializeReaderConnection.switchToReader in interface ReaderResolverctx - the read/write splitting contextjava.sql.SQLException