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
`protected long` `waitTimeout`

### Fields inherited from class org.mariadb.jdbc.client.impl.MultiPrimaryClient

`closed, conf, currentClient, deniedListTimeout, denyList, lock`

### Constructor Summary

Constructors
`MultiPrimaryReplicaClient​(Configuration conf, ReentrantLock lock)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `abort​(Executor executor)`
`void` `close()`
`void` `closePrepare​(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.Context` `getContext()`
`ExceptionFactory` `getExceptionFactory()`
`HostAddress` `getHostAddress()`
`int` `getSocketTimeout()`
`boolean` `isPrimary()`
`void` `readStreamingResults​(List<org.mariadb.jdbc.client.Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)`
`protected void` `reConnect()` Reconnect connection, trying to continue transparently if possible.
`void` `reset()`
`void` `setReadOnly​(boolean readOnly)`
`void` `setSocketTimeout​(int milliseconds)`

### Methods inherited from class org.mariadb.jdbc.client.impl.MultiPrimaryClient

`connectHost, execute, execute, executeTransactionReplay, getWaitTimeout, isClosed, syncNewState`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### waitTimeout

    protected long waitTimeout

### Constructor Detail

#### MultiPrimaryReplicaClient

    public MultiPrimaryReplicaClient​(Configuration conf,
                                     ReentrantLock lock)
                              throws SQLException

Throws:
  `SQLException`

### Method Detail

#### reConnect

    protected void reConnect()
                      throws SQLException

Reconnect connection, trying to continue transparently if possible. Different possible cases : replica fails, then reconnect to replica or to master if no replica available

if reconnect succeed on replica / use master, no problem, continuing without interruption // if reconnect primary, then replay transaction / throw exception if was in transaction.

Overrides:
  `reConnect` in class `MultiPrimaryClient`
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:
  `execute` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `execute` in class `MultiPrimaryClient`
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:
  `executePipeline` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `executePipeline` in class `MultiPrimaryClient`
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:
  `readStreamingResults` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `readStreamingResults` in class `MultiPrimaryClient`
Throws:
  `SQLException`

#### closePrepare

    public void closePrepare​(Prepare prepare)
                      throws SQLException

Specified by:
  `closePrepare` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `closePrepare` in class `MultiPrimaryClient`
Throws:
  `SQLException`

#### abort

    public void abort​(Executor executor)
               throws SQLException

Specified by:
  `abort` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `abort` in class `MultiPrimaryClient`
Throws:
  `SQLException`

#### close

    public void close()

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `close` in class `MultiPrimaryClient`

#### setReadOnly

    public void setReadOnly​(boolean readOnly)
                     throws SQLException

Specified by:
  `setReadOnly` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `setReadOnly` in class `MultiPrimaryClient`
Throws:
  `SQLException`

#### getSocketTimeout

    public int getSocketTimeout()

Specified by:
  `getSocketTimeout` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `getSocketTimeout` in class `MultiPrimaryClient`

#### setSocketTimeout

    public void setSocketTimeout​(int milliseconds)
                          throws SQLException

Specified by:
  `setSocketTimeout` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `setSocketTimeout` in class `MultiPrimaryClient`
Throws:
  `SQLException`

#### getContext

    public org.mariadb.jdbc.client.Context getContext()

Specified by:
  `getContext` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `getContext` in class `MultiPrimaryClient`

#### getExceptionFactory

    public ExceptionFactory getExceptionFactory()

Specified by:
  `getExceptionFactory` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `getExceptionFactory` in class `MultiPrimaryClient`

#### getHostAddress

    public HostAddress getHostAddress()

Specified by:
  `getHostAddress` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `getHostAddress` in class `MultiPrimaryClient`

#### isPrimary

    public boolean isPrimary()

Specified by:
  `isPrimary` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `isPrimary` in class `MultiPrimaryClient`

#### reset

    public void reset()

Specified by:
  `reset` in interface `org.mariadb.jdbc.client.Client`
Overrides:
  `reset` in class `MultiPrimaryClient`