public class EndpointConnectionVerifier
extends java.lang.Object
SimpleReadWriteSplittingPlugin.getVerifiedConnection. Repeatedly opens a connection and
checks its HostRole until the deadline; a login exception aborts immediately. The clock
is injectable via NanoTimeSource for deterministic unit tests.| Constructor and Description |
|---|
EndpointConnectionVerifier(long connectRetryTimeoutMs,
int connectRetryIntervalMs,
NanoTimeSource timeSource) |
| Modifier and Type | Method and Description |
|---|---|
@Nullable java.sql.Connection |
getVerifiedConnection(RwSplitContext ctx,
java.util.Properties props,
@Nullable HostSpec hostSpec,
HostRole hostRole,
@Nullable JdbcCallable<java.sql.Connection,java.sql.SQLException> connectFunc)
Opens a verified connection to
hostSpec (or via connectFunc when non-null),
retrying until the timeout. |
public EndpointConnectionVerifier(long connectRetryTimeoutMs,
int connectRetryIntervalMs,
NanoTimeSource timeSource)
public @Nullable java.sql.Connection getVerifiedConnection(RwSplitContext ctx, java.util.Properties props, @Nullable HostSpec hostSpec, HostRole hostRole, @Nullable JdbcCallable<java.sql.Connection,java.sql.SQLException> connectFunc) throws java.sql.SQLException
hostSpec (or via connectFunc when non-null),
retrying until the timeout. Returns null if verification could not be completed.java.sql.SQLException