类 ReplicationConnectionGroup


  • public class ReplicationConnectionGroup
    extends Object
    Group of connection objects which can be configured as a group. This is used for promotion/demotion of replicas and sources in a replication configuration, and for exposing metrics around replication-aware connections.
    • 方法详细资料

      • getConnectionCount

        public long getConnectionCount()
      • getGroupName

        public String getGroupName()
      • addReplicaHost

        public void addReplicaHost​(String hostPortPair)
                            throws SQLException
        Adds a host to the replicas hosts list. We can safely assume that if this host was added to the replicas list, then it must be added to each one of the replication connections from this group as well. Unnecessary calls to ReplicationConnection.addReplicaHost(String) could result in undesirable locking issues, assuming that this method is synchronized by nature. This is a no-op if the group already has this host in a replica role.
        参数:
        hostPortPair - "host:port"
        抛出:
        SQLException - if an error occurs
      • removeReplicaHost

        public void removeReplicaHost​(String hostPortPair,
                                      boolean closeGently)
                               throws SQLException
        Removes a host from the replicas hosts list. We can safely assume that if this host was removed from the replicas list, then it must be removed from each one of the replication connections from this group as well. Unnecessary calls to ReplicationConnection.removeReplica(String, boolean) could result in undesirable locking issues, assuming that this method is synchronized by nature. This is a no-op if the group doesn't have this host in a replica role.
        参数:
        hostPortPair - "host:port"
        closeGently - remove host when it's not in use
        抛出:
        SQLException - if an error occurs
      • promoteReplicaToSource

        public void promoteReplicaToSource​(String hostPortPair)
                                    throws SQLException
        Promotes a replica host to source. We can safely assume that if this host was removed from the replicas list or added to the sources list, then the same host promotion must happen in each one of the replication connections from this group as well. Unnecessary calls to ReplicationConnection.promoteReplicaToSource(String) could result in undesirable locking issues, assuming that this method is synchronized by nature. This is a no-op if the group already has this host in a source role and not in replica role.
        参数:
        hostPortPair - "host:port"
        抛出:
        SQLException - if an error occurs
      • removeSourceHost

        public void removeSourceHost​(String hostPortPair)
                              throws SQLException
        Removes a host from the sources hosts list.
        参数:
        hostPortPair - host:port
        抛出:
        SQLException - if an error occurs
      • removeSourceHost

        public void removeSourceHost​(String hostPortPair,
                                     boolean closeGently)
                              throws SQLException
        Removes a host from the sources hosts list. We can safely assume that if this host was removed from the sources list, then it must be removed from each one of the replication connections from this group as well. Unnecessary calls to ReplicationConnection.removeSourceHost(String, boolean) could result in undesirable locking issues, assuming that this method is synchronized by nature. This is a no-op if the group doesn't have this host in a source role.
        参数:
        hostPortPair - "host:port"
        closeGently - remove host when it's not in use
        抛出:
        SQLException - if an error occurs
      • getConnectionCountWithHostAsReplica

        public int getConnectionCountWithHostAsReplica​(String hostPortPair)
      • getConnectionCountWithHostAsSource

        public int getConnectionCountWithHostAsSource​(String hostPortPair)
      • getNumberOfReplicasAdded

        public long getNumberOfReplicasAdded()
      • getNumberOfReplicasRemoved

        public long getNumberOfReplicasRemoved()
      • getNumberOfReplicaPromotions

        public long getNumberOfReplicaPromotions()
      • getTotalConnectionCount

        public long getTotalConnectionCount()
      • getActiveConnectionCount

        public long getActiveConnectionCount()