Class ZooKeeperEndpointGroup
- java.lang.Object
-
- com.linecorp.armeria.common.util.AbstractListenable<List<com.linecorp.armeria.client.Endpoint>>
-
- com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
-
- com.linecorp.armeria.client.zookeeper.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-basedEndpointGroup
implementation. ThisEndpointGroup
retrieves the list ofEndpoint
s from a ZooKeeper usingNodeValueCodec
and updates it when the children of the zNode changes.
-
-
Constructor Summary
Constructors Constructor Description ZooKeeperEndpointGroup(String zkConnectionStr, String zNodePath, int sessionTimeout)
Create a ZooKeeper-basedEndpointGroup
, endpoints will be retrieved from a node's all children's node value usingNodeValueCodec
.ZooKeeperEndpointGroup(String zkConnectionStr, String zNodePath, int sessionTimeout, NodeValueCodec nodeValueCodec)
Create a ZooKeeper-basedEndpointGroup
, endpoints will be retrieved from a node's all children's node value usingNodeValueCodec
.ZooKeeperEndpointGroup(org.apache.curator.framework.CuratorFramework client, String zNodePath, NodeValueCodec nodeValueCodec)
Create a ZooKeeper-basedEndpointGroup
, endpoints will be retrieved from a node's all children's node value usingNodeValueCodec
.
-
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
-
-
-
-
Constructor Detail
-
ZooKeeperEndpointGroup
public ZooKeeperEndpointGroup(String zkConnectionStr, String zNodePath, int sessionTimeout)
Create a ZooKeeper-basedEndpointGroup
, endpoints will be retrieved from a node's all children's node value usingNodeValueCodec
.- Parameters:
zkConnectionStr
- a connection string containing a comma separated list ofhost:port
pairs, each corresponding to a ZooKeeper serverzNodePath
- 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-basedEndpointGroup
, endpoints will be retrieved from a node's all children's node value usingNodeValueCodec
.- Parameters:
zkConnectionStr
- a connection string containing a comma separated list ofhost:port
pairs, each corresponding to a ZooKeeper serverzNodePath
- a zNode path e.g."/groups/productionGroups"
sessionTimeout
- ZooKeeper session timeout in millisecondsnodeValueCodec
- theNodeValueCodec
-
ZooKeeperEndpointGroup
public ZooKeeperEndpointGroup(org.apache.curator.framework.CuratorFramework client, String zNodePath, NodeValueCodec nodeValueCodec)
Create a ZooKeeper-basedEndpointGroup
, endpoints will be retrieved from a node's all children's node value usingNodeValueCodec
.- Parameters:
client
- theCuratorFramework
instancezNodePath
- a zNode path e.g."/groups/productionGroups"
nodeValueCodec
- theNodeValueCodec
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacecom.linecorp.armeria.client.endpoint.EndpointGroup
- Specified by:
close
in interfacecom.linecorp.armeria.common.util.SafeCloseable
- Overrides:
close
in classcom.linecorp.armeria.client.endpoint.DynamicEndpointGroup
-
-