public interface EndpointGroup extends Listenable<List<Endpoint>>, SafeCloseable
Endpoints.| Modifier and Type | Method and Description |
|---|---|
default void |
addListener(Consumer<? super List<Endpoint>> listener)
Adds a
Consumer that will be invoked when a Listenable changes its value. |
default List<Endpoint> |
awaitInitialEndpoints()
Waits until the initial
Endpoints are ready. |
default List<Endpoint> |
awaitInitialEndpoints(long timeout,
TimeUnit unit)
Waits until the initial
Endpoints are ready, with timeout. |
default void |
close() |
static EndpointGroup |
empty()
Returns a singleton
EndpointGroup which does not contain any Endpoints. |
List<Endpoint> |
endpoints()
Return the endpoints held by this
EndpointGroup. |
CompletableFuture<List<Endpoint>> |
initialEndpointsFuture()
Returns a
CompletableFuture which is completed when the initial Endpoints are ready. |
static EndpointGroup |
of(EndpointGroup... endpointGroups)
|
static EndpointGroup |
of(Iterable<? extends EndpointGroup> endpointGroups)
|
default EndpointGroup |
orElse(EndpointGroup nextEndpointGroup) |
default void |
removeListener(Consumer<?> listener)
Remove a listener.
|
static EndpointGroup empty()
EndpointGroup which does not contain any Endpoints.static EndpointGroup of(EndpointGroup... endpointGroups)
EndpointGroup that combines all the Endpoints of endpointGroups.
endpointGroups can be instances of Endpoint as well, any EndpointGroups and
Endpoint will all be combined into a single EndpointGroup that contains the total set.static EndpointGroup of(Iterable<? extends EndpointGroup> endpointGroups)
EndpointGroup that combines all the Endpoints of endpointGroups.
endpointGroups can be instances of Endpoint as well, any EndpointGroups and
Endpoint will all be combined into a single EndpointGroup that contains the total set.List<Endpoint> endpoints()
EndpointGroup.CompletableFuture<List<Endpoint>> initialEndpointsFuture()
CompletableFuture which is completed when the initial Endpoints are ready.default List<Endpoint> awaitInitialEndpoints() throws InterruptedException
Endpoints are ready.CancellationException - if close() was called before the initial Endpoints are setInterruptedExceptiondefault List<Endpoint> awaitInitialEndpoints(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
Endpoints are ready, with timeout.CancellationException - if close() was called before the initial Endpoints are setTimeoutException - if the initial Endpoints are not set until timeoutInterruptedExceptiondefault void addListener(Consumer<? super List<Endpoint>> listener)
ListenableConsumer that will be invoked when a Listenable changes its value.addListener in interface Listenable<List<Endpoint>>default void removeListener(Consumer<?> listener)
ListenableremoveListener in interface Listenable<List<Endpoint>>default void close()
close in interface AutoCloseableclose in interface SafeCloseabledefault EndpointGroup orElse(EndpointGroup nextEndpointGroup)
Copyright © 2020 LeanCloud. All rights reserved.