Class ZooKeeperEndpointGroup

  • All Implemented Interfaces:
    com.linecorp.armeria.client.endpoint.EndpointGroup, com.linecorp.armeria.common.util.Listenable<List<com.linecorp.armeria.client.Endpoint>>, com.linecorp.armeria.common.util.SafeCloseable, AutoCloseable

    public class ZooKeeperEndpointGroup
    extends com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
    A ZooKeeper-based EndpointGroup implementation. This EndpointGroup retrieves the list of Endpoints from a ZooKeeper using NodeValueCodec and updates it when the children of the zNode changes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      • Methods inherited from class com.linecorp.armeria.client.endpoint.DynamicEndpointGroup

        addEndpoint, endpoints, initialEndpointsFuture, removeEndpoint, setEndpoints
      • Methods inherited from class com.linecorp.armeria.common.util.AbstractListenable

        addListener, notifyListeners, removeListener
      • Methods inherited from interface com.linecorp.armeria.client.endpoint.EndpointGroup

        addListener, awaitInitialEndpoints, awaitInitialEndpoints, orElse, removeListener
    • Constructor Detail

      • ZooKeeperEndpointGroup

        public ZooKeeperEndpointGroup​(String zkConnectionStr,
                                      String zNodePath,
                                      int sessionTimeout)
        Create a ZooKeeper-based EndpointGroup, endpoints will be retrieved from a node's all children's node value using NodeValueCodec.
        Parameters:
        zkConnectionStr - a connection string containing a comma separated list of host:port pairs, each corresponding to a ZooKeeper server
        zNodePath - a zNode path e.g. "/groups/productionGroups"
        sessionTimeout - ZooKeeper session timeout in milliseconds
      • ZooKeeperEndpointGroup

        public ZooKeeperEndpointGroup​(String zkConnectionStr,
                                      String zNodePath,
                                      int sessionTimeout,
                                      NodeValueCodec nodeValueCodec)
        Create a ZooKeeper-based EndpointGroup, endpoints will be retrieved from a node's all children's node value using NodeValueCodec.
        Parameters:
        zkConnectionStr - a connection string containing a comma separated list of host:port pairs, each corresponding to a ZooKeeper server
        zNodePath - a zNode path e.g. "/groups/productionGroups"
        sessionTimeout - ZooKeeper session timeout in milliseconds
        nodeValueCodec - the NodeValueCodec
      • ZooKeeperEndpointGroup

        public ZooKeeperEndpointGroup​(org.apache.curator.framework.CuratorFramework client,
                                      String zNodePath,
                                      NodeValueCodec nodeValueCodec)
        Create a ZooKeeper-based EndpointGroup, endpoints will be retrieved from a node's all children's node value using NodeValueCodec.
        Parameters:
        client - the CuratorFramework instance
        zNodePath - a zNode path e.g. "/groups/productionGroups"
        nodeValueCodec - the NodeValueCodec
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface com.linecorp.armeria.client.endpoint.EndpointGroup
        Specified by:
        close in interface com.linecorp.armeria.common.util.SafeCloseable
        Overrides:
        close in class com.linecorp.armeria.client.endpoint.DynamicEndpointGroup