Class 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 Detail

      • waitTimeout

        protected long waitTimeout
    • 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
      • getSocketTimeout

        public int getSocketTimeout()
        Specified by:
        getSocketTimeout in interface org.mariadb.jdbc.client.Client
        Overrides:
        getSocketTimeout in class MultiPrimaryClient
      • getContext

        public org.mariadb.jdbc.client.Context getContext()
        Specified by:
        getContext in interface org.mariadb.jdbc.client.Client
        Overrides:
        getContext 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