public class AkkaRpcServiceUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AkkaRpcServiceUtils.AkkaProtocol |
Modifier and Type | Method and Description |
---|---|
static InetSocketAddress |
createInetSocketAddressFromAkkaURL(String akkaURL)
Extracts the hostname and the port of the remote actor system from the given Akka URL.
|
static String |
createRandomName(String prefix)
Creates a random name of the form prefix_X, where X is an increasing number.
|
static RpcService |
createRpcService(String hostname,
int port,
Configuration configuration)
Utility method to create RPC service from configuration and hostname, port.
|
static String |
getRpcUrl(String hostname,
int port,
String endpointName,
HighAvailabilityServicesUtils.AddressResolution addressResolution,
AkkaRpcServiceUtils.AkkaProtocol akkaProtocol) |
static String |
getRpcUrl(String hostname,
int port,
String endpointName,
HighAvailabilityServicesUtils.AddressResolution addressResolution,
Configuration config) |
public static RpcService createRpcService(String hostname, int port, Configuration configuration) throws Exception
hostname
- The hostname/address that describes the TaskManager's data location.port
- If true, the TaskManager will not initiate the TCP network stack.configuration
- The configuration for the TaskManager.IOException
- Thrown, if the actor system can not bind to the addressException
- Thrown is some other error occurs while creating akka actor systempublic static String getRpcUrl(String hostname, int port, String endpointName, HighAvailabilityServicesUtils.AddressResolution addressResolution, Configuration config) throws UnknownHostException
hostname
- The hostname or address where the target RPC service is listening.port
- The port where the target RPC service is listening.endpointName
- The name of the RPC endpoint.addressResolution
- Whether to try address resolution of the given hostname or not.
This allows to fail fast in case that the hostname cannot be resolved.config
- The configuration from which to deduce further settings.UnknownHostException
public static String getRpcUrl(String hostname, int port, String endpointName, HighAvailabilityServicesUtils.AddressResolution addressResolution, AkkaRpcServiceUtils.AkkaProtocol akkaProtocol) throws UnknownHostException
hostname
- The hostname or address where the target RPC service is listening.port
- The port where the target RPC service is listening.endpointName
- The name of the RPC endpoint.addressResolution
- Whether to try address resolution of the given hostname or not.
This allows to fail fast in case that the hostname cannot be resolved.akkaProtocol
- True, if security/encryption is enabled, false otherwise.UnknownHostException
public static String createRandomName(String prefix)
prefix
- Prefix string to prepend to the monotonically increasing name offset numberpublic static InetSocketAddress createInetSocketAddressFromAkkaURL(String akkaURL) throws Exception
InetSocketAddress
instance containing the extracted hostname and port. If
the Akka URL does not contain the hostname and port information, e.g. a local Akka URL is
provided, then an Exception
is thrown.akkaURL
- The URL to extract the host and port from.Exception
- Thrown, if the given string does not represent a proper urlCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.