Class PropertiesEndpointGroup
- java.lang.Object
-
- com.linecorp.armeria.client.endpoint.PropertiesEndpointGroup
-
- All Implemented Interfaces:
EndpointGroup
,Listenable<List<Endpoint>>
,SafeCloseable
,AutoCloseable
public final class PropertiesEndpointGroup extends Object implements EndpointGroup
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Endpoint>
endpoints()
Return the endpoints held by thisEndpointGroup
.static PropertiesEndpointGroup
of(ClassLoader classLoader, String resourceName, String endpointKeyPrefix)
Creates a newEndpointGroup
instance that loads the host names (or IP address) and the port numbers of theEndpoint
from theresourceName
resource file.static PropertiesEndpointGroup
of(ClassLoader classLoader, String resourceName, String endpointKeyPrefix, int defaultPort)
Creates a newEndpointGroup
instance that loads the host names (or IP address) and the port numbers of theEndpoint
from theresourceName
resource file.static PropertiesEndpointGroup
of(Properties properties, String endpointKeyPrefix)
Creates a newEndpointGroup
instance that loads the host names (or IP address) and the port numbers of theEndpoint
from theProperties
.static PropertiesEndpointGroup
of(Properties properties, String endpointKeyPrefix, int defaultPort)
Creates a newEndpointGroup
instance that loads the host names (or IP address) and the port numbers of theEndpoint
from theProperties
.-
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, close, orElse, removeListener
-
-
-
-
Method Detail
-
of
public static PropertiesEndpointGroup of(ClassLoader classLoader, String resourceName, String endpointKeyPrefix)
Creates a newEndpointGroup
instance that loads the host names (or IP address) and the port numbers of theEndpoint
from theresourceName
resource file. The resource file must contain at least one property whose name starts withendpointKeyPrefix
: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- Throws:
IllegalArgumentException
- if failed to load any hosts from the specified resource file
-
of
public static PropertiesEndpointGroup of(ClassLoader classLoader, String resourceName, String endpointKeyPrefix, int defaultPort)
Creates a newEndpointGroup
instance that loads the host names (or IP address) and the port numbers of theEndpoint
from theresourceName
resource file. The resource file must contain at least one property whose name starts withendpointKeyPrefix
: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 prefixdefaultPort
- the default port number to use- Throws:
IllegalArgumentException
- if failed to load any hosts from the specified resource file
-
of
public static PropertiesEndpointGroup of(Properties properties, String endpointKeyPrefix)
Creates a newEndpointGroup
instance that loads the host names (or IP address) and the port numbers of theEndpoint
from theProperties
. TheProperties
must contain at least one property whose name starts withendpointKeyPrefix
: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- Throws:
IllegalArgumentException
- if failed to load any hosts from the specifiedProperties
-
of
public static PropertiesEndpointGroup of(Properties properties, String endpointKeyPrefix, int defaultPort)
Creates a newEndpointGroup
instance that loads the host names (or IP address) and the port numbers of theEndpoint
from theProperties
. TheProperties
must contain at least one property whose name starts withendpointKeyPrefix
: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 prefixdefaultPort
- the default port number to use- Throws:
IllegalArgumentException
- if failed to load any hosts from the specifiedProperties
-
endpoints
public List<Endpoint> endpoints()
Description copied from interface:EndpointGroup
Return the endpoints held by thisEndpointGroup
.- Specified by:
endpoints
in interfaceEndpointGroup
-
-