public class StickyReaderPolicy extends java.lang.Object implements LoadBalancingPolicy
LoadBalancingPolicy that selects a reader using the configured host-selector strategy.
The unified plugin reuses a single cached reader (the sticky behavior) and only invokes this to
pick a new reader when none is cached.| Constructor and Description |
|---|
StickyReaderPolicy(java.lang.String readerSelectorStrategy) |
| Modifier and Type | Method and Description |
|---|---|
@Nullable HostSpec |
pickReader(RwSplitContext ctx,
java.util.List<HostSpec> candidates)
Selects the reader target for this request, or
null when no eligible target is
available. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisPerQuerypublic StickyReaderPolicy(java.lang.String readerSelectorStrategy)
public @Nullable HostSpec pickReader(RwSplitContext ctx, java.util.List<HostSpec> candidates) throws java.sql.SQLException
LoadBalancingPolicynull when no eligible target is
available.pickReader in interface LoadBalancingPolicyctx - the read/write splitting contextcandidates - the eligible reader candidatesnull if none is availablejava.sql.SQLException