Class PropertiesEndpointGroup
java.lang.Object
com.linecorp.armeria.common.util.AbstractListenable<List<Endpoint>>
com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
com.linecorp.armeria.client.endpoint.PropertiesEndpointGroup
- All Implemented Interfaces:
EndpointGroup
,EndpointSelector
,AsyncCloseable
,Listenable<List<Endpoint>>
,ListenableAsyncCloseable
,AutoCloseable
public final class PropertiesEndpointGroup extends DynamicEndpointGroup
-
Method Summary
Modifier and Type Method Description static PropertiesEndpointGroupBuilder
builder(ClassLoader classLoader, String resourceName, String endpointKeyPrefix)
Returns a newPropertiesEndpointGroupBuilder
created from the specified classpath resource.static PropertiesEndpointGroupBuilder
builder(Path path, String endpointKeyPrefix)
Returns a newPropertiesEndpointGroupBuilder
created from the file at the specifiedPath
.static PropertiesEndpointGroupBuilder
builder(Properties properties, String endpointKeyPrefix)
Returns a newPropertiesEndpointGroupBuilder
created from the specifiedProperties
.protected void
doCloseAsync(CompletableFuture<?> future)
Override this method to release the resources held by thisEndpointGroup
and complete the specifiedCompletableFuture
.static PropertiesEndpointGroup
of(ClassLoader classLoader, String resourceName, String endpointKeyPrefix)
Returns a newPropertiesEndpointGroup
created from the specified classpath resource.static PropertiesEndpointGroup
of(Path path, String endpointKeyPrefix)
Returns a newPropertiesEndpointGroup
created from the file at the specifiedPath
.static PropertiesEndpointGroup
of(Properties properties, String endpointKeyPrefix)
Returns a newPropertiesEndpointGroup
created from the specifiedProperties
.Methods inherited from class com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
addEndpoint, close, closeAsync, endpoints, isClosed, isClosing, removeEndpoint, select, selectionStrategy, selectNow, setEndpoints, whenClosed, whenReady
Methods inherited from class com.linecorp.armeria.common.util.AbstractListenable
addListener, notifyListeners, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.client.endpoint.EndpointGroup
addListener, orElse, removeListener
-
Method Details
-
of
public static PropertiesEndpointGroup of(ClassLoader classLoader, String resourceName, String endpointKeyPrefix)Returns a newPropertiesEndpointGroup
created from the specified classpath resource. The value of each property whose name starts withendpointKeyPrefix
will be parsed withEndpoint.parse(String)
, and then loaded into thePropertiesEndpointGroup
, e.g.# endpointKeyPrefix = 'example.hosts.' example.hosts.0=example1.com:36462 example.hosts.1=example2.com:36462 example.hosts.2=example3.com:36462
- Parameters:
resourceName
- the name of the resource where the list ofEndpoint
s is loaded fromendpointKeyPrefix
- the property name prefix
-
of
Returns a newPropertiesEndpointGroup
created from the specifiedProperties
. The value of each property whose name starts withendpointKeyPrefix
will be parsed withEndpoint.parse(String)
, and then loaded into thePropertiesEndpointGroup
, e.g.# endpointKeyPrefix = 'example.hosts.' example.hosts.0=example1.com:36462 example.hosts.1=example2.com:36462 example.hosts.2=example3.com:36462
- Parameters:
properties
- theProperties
where the list ofEndpoint
s is loaded fromendpointKeyPrefix
- the property name prefix
-
of
Returns a newPropertiesEndpointGroup
created from the file at the specifiedPath
. Any updates in the file will trigger a dynamic reload. The value of each property whose name starts withendpointKeyPrefix
will be parsed withEndpoint.parse(String)
, and then loaded into thePropertiesEndpointGroup
, e.g.# endpointKeyPrefix = 'example.hosts.' example.hosts.0=example1.com:36462 example.hosts.1=example2.com:36462 example.hosts.2=example3.com:36462
- Parameters:
path
- the path of the file where list ofEndpoint
s is loaded fromendpointKeyPrefix
- the property name prefix
-
builder
public static PropertiesEndpointGroupBuilder builder(ClassLoader classLoader, String resourceName, String endpointKeyPrefix)Returns a newPropertiesEndpointGroupBuilder
created from the specified classpath resource. The value of each property whose name starts withendpointKeyPrefix
will be parsed withEndpoint.parse(String)
, and then loaded into thePropertiesEndpointGroup
, e.g.# endpointKeyPrefix = 'example.hosts.' example.hosts.0=example1.com:36462 example.hosts.1=example2.com:36462 example.hosts.2=example3.com:36462
- Parameters:
resourceName
- the name of the resource where the list ofEndpoint
s is loaded fromendpointKeyPrefix
- the property name prefix
-
builder
public static PropertiesEndpointGroupBuilder builder(Properties properties, String endpointKeyPrefix)Returns a newPropertiesEndpointGroupBuilder
created from the specifiedProperties
. The value of each property whose name starts withendpointKeyPrefix
will be parsed withEndpoint.parse(String)
, and then loaded into thePropertiesEndpointGroup
, e.g.# endpointKeyPrefix = 'example.hosts.' example.hosts.0=example1.com:36462 example.hosts.1=example2.com:36462 example.hosts.2=example3.com:36462
- Parameters:
properties
- theProperties
where the list ofEndpoint
s is loaded fromendpointKeyPrefix
- the property name prefix
-
builder
Returns a newPropertiesEndpointGroupBuilder
created from the file at the specifiedPath
. Any updates in the file will trigger a dynamic reload. The value of each property whose name starts withendpointKeyPrefix
will be parsed withEndpoint.parse(String)
, and then loaded into thePropertiesEndpointGroup
, e.g.# endpointKeyPrefix = 'example.hosts.' example.hosts.0=example1.com:36462 example.hosts.1=example2.com:36462 example.hosts.2=example3.com:36462
- Parameters:
path
- the path of the file where list ofEndpoint
s is loaded fromendpointKeyPrefix
- the property name prefix
-
doCloseAsync
Description copied from class:DynamicEndpointGroup
Override this method to release the resources held by thisEndpointGroup
and complete the specifiedCompletableFuture
.- Overrides:
doCloseAsync
in classDynamicEndpointGroup
-