Package org.mariadb.jdbc.client.impl
Class MultiPrimaryReplicaClient
- java.lang.Object
-
- org.mariadb.jdbc.client.impl.MultiPrimaryClient
-
- org.mariadb.jdbc.client.impl.MultiPrimaryReplicaClient
-
- All Implemented Interfaces:
AutoCloseable,org.mariadb.jdbc.client.Client
public class MultiPrimaryReplicaClient extends MultiPrimaryClient
Handling connection failing automatic reconnection transparently when possible for replication Topology.remark: would have been better using proxy, but for AOT compilation, avoiding to using not supported proxy class.
-
-
Field Summary
Fields Modifier and Type Field Description protected longwaitTimeout-
Fields inherited from class org.mariadb.jdbc.client.impl.MultiPrimaryClient
closed, conf, currentClient, deniedListTimeout, denyList, lock
-
-
Constructor Summary
Constructors Constructor Description MultiPrimaryReplicaClient(Configuration conf, ReentrantLock lock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Executor executor)voidclose()voidclosePrepare(Prepare prepare)List<org.mariadb.jdbc.client.Completion>execute(org.mariadb.jdbc.message.ClientMessage message, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)List<org.mariadb.jdbc.client.Completion>executePipeline(org.mariadb.jdbc.message.ClientMessage[] messages, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)org.mariadb.jdbc.client.ContextgetContext()ExceptionFactorygetExceptionFactory()HostAddressgetHostAddress()intgetSocketTimeout()booleanisPrimary()voidreadStreamingResults(List<org.mariadb.jdbc.client.Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)protected voidreConnect()Reconnect connection, trying to continue transparently if possible.voidreset()voidsetReadOnly(boolean readOnly)voidsetSocketTimeout(int milliseconds)-
Methods inherited from class org.mariadb.jdbc.client.impl.MultiPrimaryClient
connectHost, execute, execute, executeTransactionReplay, getWaitTimeout, isClosed, syncNewState
-
-
-
-
Constructor Detail
-
MultiPrimaryReplicaClient
public MultiPrimaryReplicaClient(Configuration conf, ReentrantLock lock) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
reConnect
protected void reConnect() throws SQLExceptionReconnect connection, trying to continue transparently if possible. Different possible cases : replica fails, then reconnect to replica or to master if no replica availableif reconnect succeed on replica / use master, no problem, continuing without interruption // if reconnect primary, then replay transaction / throw exception if was in transaction.
- Overrides:
reConnectin classMultiPrimaryClient- Throws:
SQLException- if exception
-
execute
public List<org.mariadb.jdbc.client.Completion> execute(org.mariadb.jdbc.message.ClientMessage message, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
- Specified by:
executein interfaceorg.mariadb.jdbc.client.Client- Overrides:
executein classMultiPrimaryClient- Throws:
SQLException
-
executePipeline
public List<org.mariadb.jdbc.client.Completion> executePipeline(org.mariadb.jdbc.message.ClientMessage[] messages, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
- Specified by:
executePipelinein interfaceorg.mariadb.jdbc.client.Client- Overrides:
executePipelinein classMultiPrimaryClient- Throws:
SQLException
-
readStreamingResults
public void readStreamingResults(List<org.mariadb.jdbc.client.Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
- Specified by:
readStreamingResultsin interfaceorg.mariadb.jdbc.client.Client- Overrides:
readStreamingResultsin classMultiPrimaryClient- Throws:
SQLException
-
closePrepare
public void closePrepare(Prepare prepare) throws SQLException
- Specified by:
closePreparein interfaceorg.mariadb.jdbc.client.Client- Overrides:
closePreparein classMultiPrimaryClient- Throws:
SQLException
-
abort
public void abort(Executor executor) throws SQLException
- Specified by:
abortin interfaceorg.mariadb.jdbc.client.Client- Overrides:
abortin classMultiPrimaryClient- Throws:
SQLException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.mariadb.jdbc.client.Client- Overrides:
closein classMultiPrimaryClient
-
setReadOnly
public void setReadOnly(boolean readOnly) throws SQLException- Specified by:
setReadOnlyin interfaceorg.mariadb.jdbc.client.Client- Overrides:
setReadOnlyin classMultiPrimaryClient- Throws:
SQLException
-
getSocketTimeout
public int getSocketTimeout()
- Specified by:
getSocketTimeoutin interfaceorg.mariadb.jdbc.client.Client- Overrides:
getSocketTimeoutin classMultiPrimaryClient
-
setSocketTimeout
public void setSocketTimeout(int milliseconds) throws SQLException- Specified by:
setSocketTimeoutin interfaceorg.mariadb.jdbc.client.Client- Overrides:
setSocketTimeoutin classMultiPrimaryClient- Throws:
SQLException
-
getContext
public org.mariadb.jdbc.client.Context getContext()
- Specified by:
getContextin interfaceorg.mariadb.jdbc.client.Client- Overrides:
getContextin classMultiPrimaryClient
-
getExceptionFactory
public ExceptionFactory getExceptionFactory()
- Specified by:
getExceptionFactoryin interfaceorg.mariadb.jdbc.client.Client- Overrides:
getExceptionFactoryin classMultiPrimaryClient
-
getHostAddress
public HostAddress getHostAddress()
- Specified by:
getHostAddressin interfaceorg.mariadb.jdbc.client.Client- Overrides:
getHostAddressin classMultiPrimaryClient
-
isPrimary
public boolean isPrimary()
- Specified by:
isPrimaryin interfaceorg.mariadb.jdbc.client.Client- Overrides:
isPrimaryin classMultiPrimaryClient
-
reset
public void reset()
- Specified by:
resetin interfaceorg.mariadb.jdbc.client.Client- Overrides:
resetin classMultiPrimaryClient
-
-