Class MasterProtocol

All Implemented Interfaces:
Closeable, AutoCloseable, Protocol
Direct Known Subclasses:
MastersReplicasProtocol

public class MasterProtocol extends AbstractQueryProtocol implements Closeable
  • Constructor Details

    • MasterProtocol

      public MasterProtocol(UrlParser urlParser, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)
      Get a protocol instance.
      Parameters:
      urlParser - connection URL infos
      globalInfo - server global variables information
      lock - the lock for thread synchronisation
      traceCache - trace cache
  • Method Details

    • getNewProtocol

      private static MasterProtocol getNewProtocol(FailoverProxy proxy, GlobalStateInfo globalInfo, UrlParser urlParser)
      Get new instance.
      Parameters:
      proxy - proxy
      urlParser - url connection object
      Returns:
      new instance
    • loop

      public static void loop(Listener listener, GlobalStateInfo globalInfo, List<HostAddress> addresses, SearchFilter searchFilter) throws SQLException
      loop until found the failed connection.
      Parameters:
      listener - current failover
      globalInfo - server global variables information
      addresses - list of HostAddress to loop
      searchFilter - search parameter
      Throws:
      SQLException - if not found
    • resetHostList

      private static void resetHostList(Listener listener, Deque<HostAddress> loopAddresses)
      Reinitialize loopAddresses with all hosts : all servers in randomize order without connected host.
      Parameters:
      listener - current listener
      loopAddresses - the list to reinitialize