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.client.endpoint.EndpointSelector
,com.linecorp.armeria.common.util.AsyncCloseable
,com.linecorp.armeria.common.util.Listenable<List<com.linecorp.armeria.client.Endpoint>>
,com.linecorp.armeria.common.util.ListenableAsyncCloseable
,AutoCloseable
public final class ZooKeeperEndpointGroup
extends com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
A ZooKeeper-based
EndpointGroup
implementation. This EndpointGroup
retrieves the list of
Endpoint
s from a ZooKeeper using NodeValueCodec
and updates it when the children of the
zNode changes.- See Also:
ZooKeeperUpdatingListener
-
Method Summary
Modifier and Type Method Description static ZooKeeperEndpointGroupBuilder
builder(String zkConnectionStr, String zNodePath)
Returns a newZooKeeperEndpointGroupBuilder
created with the specified ZooKeeper connection string and ZNode path.static ZooKeeperEndpointGroupBuilder
builder(org.apache.curator.framework.CuratorFramework client, String zNodePath)
Returns a newZooKeeperEndpointGroupBuilder
created with the specifiedCuratorFramework
and ZNode path.protected void
doCloseAsync(CompletableFuture<?> future)
static ZooKeeperEndpointGroup
of(String zkConnectionStr, String zNodePath)
Returns a newZooKeeperEndpointGroup
that retrieves theEndpoint
list from the ZNode at the specified connection string and path.static ZooKeeperEndpointGroup
of(org.apache.curator.framework.CuratorFramework client, String zNodePath)
Returns a newZooKeeperEndpointGroup
that retrieves theEndpoint
list from the ZNode at the specified path using the specifiedCuratorFramework
.Methods inherited from class com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
addEndpoint, close, closeAsync, endpoints, isClosed, isClosing, removeEndpoint, select, selectionStrategy, setEndpoints, whenClosed, whenReady
Methods inherited from class com.linecorp.armeria.common.util.AbstractListenable
addListener, notifyListeners, removeListener
-
Method Details
-
of
Returns a newZooKeeperEndpointGroup
that retrieves theEndpoint
list from the ZNode at the specified connection string and path. A new ZooKeeper client will be created internally. The ZooKeeper client will be destroyed when the returnedZooKeeperEndpointGroup
is closed. -
of
public static ZooKeeperEndpointGroup of(org.apache.curator.framework.CuratorFramework client, String zNodePath)Returns a newZooKeeperEndpointGroup
that retrieves theEndpoint
list from the ZNode at the specified path using the specifiedCuratorFramework
. Note that the specifiedCuratorFramework
will not be destroyed when the returnedZooKeeperEndpointGroup
is closed. -
builder
Returns a newZooKeeperEndpointGroupBuilder
created with the specified ZooKeeper connection string and ZNode path. TheZooKeeperEndpointGroup
built by the returned builder will create a new ZooKeeper client internally. The ZooKeeper client will be destroyed when theZooKeeperEndpointGroup
is closed. -
builder
public static ZooKeeperEndpointGroupBuilder builder(org.apache.curator.framework.CuratorFramework client, String zNodePath)Returns a newZooKeeperEndpointGroupBuilder
created with the specifiedCuratorFramework
and ZNode path. Note that the specifiedCuratorFramework
will not be destroyed when theZooKeeperEndpointGroup
built by the returned builder is closed. -
doCloseAsync
- Overrides:
doCloseAsync
in classcom.linecorp.armeria.client.endpoint.DynamicEndpointGroup
-