public class CleanupOnCloseRpcSystem extends Object implements RpcSystem
RpcSystem
wrapper that cleans up resources after the RPC system has been closed.RpcSystem.FixedThreadPoolExecutorConfiguration, RpcSystem.ForkJoinExecutorConfiguration, RpcSystem.RpcServiceBuilder
Constructor and Description |
---|
CleanupOnCloseRpcSystem(RpcSystem rpcSystem,
SubmoduleClassLoader pluginLoader,
Path tempDirectory) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Hook to cleanup resources, like common thread pools or classloaders.
|
InetSocketAddress |
getInetSocketAddressFromRpcUrl(String url)
Returns an
InetSocketAddress corresponding to the given RPC url. |
long |
getMaximumMessageSizeInBytes(Configuration config)
Returns the maximum number of bytes that an RPC message may carry according to the given
configuration.
|
String |
getRpcUrl(String hostname,
int port,
String endpointName,
AddressResolution addressResolution,
Configuration config)
Constructs an RPC URL for the given parameters, that can be used to connect to the targeted
RpcService.
|
RpcSystem.RpcServiceBuilder |
localServiceBuilder(Configuration config)
Returns a builder for an
RpcService that is only reachable from the local machine. |
RpcSystem.RpcServiceBuilder |
remoteServiceBuilder(Configuration configuration,
String externalAddress,
String externalPortRange)
Returns a builder for an
RpcService that is reachable from other machines. |
public CleanupOnCloseRpcSystem(RpcSystem rpcSystem, SubmoduleClassLoader pluginLoader, @Nullable Path tempDirectory)
public void close()
RpcSystem
close
in interface AutoCloseable
close
in interface RpcSystem
public RpcSystem.RpcServiceBuilder localServiceBuilder(Configuration config)
RpcSystem
RpcService
that is only reachable from the local machine.localServiceBuilder
in interface RpcSystem
config
- Flink configurationpublic RpcSystem.RpcServiceBuilder remoteServiceBuilder(Configuration configuration, @Nullable String externalAddress, String externalPortRange)
RpcSystem
RpcService
that is reachable from other machines.remoteServiceBuilder
in interface RpcSystem
configuration
- Flink configurationexternalAddress
- optional address under which the RpcService should be reachableexternalPortRange
- port range from which 1 port will be chosen under which the
RpcService should be reachablepublic String getRpcUrl(String hostname, int port, String endpointName, AddressResolution addressResolution, Configuration config) throws UnknownHostException
RpcSystemUtils
getRpcUrl
in interface RpcSystemUtils
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 InetSocketAddress getInetSocketAddressFromRpcUrl(String url) throws Exception
RpcSystemUtils
InetSocketAddress
corresponding to the given RPC url.getInetSocketAddressFromRpcUrl
in interface RpcSystemUtils
url
- RPC urlException
- if the URL is invalidRpcSystemUtils.getRpcUrl(java.lang.String, int, java.lang.String, org.apache.flink.runtime.rpc.AddressResolution, org.apache.flink.configuration.Configuration)
public long getMaximumMessageSizeInBytes(Configuration config)
RpcSystemUtils
Long.MAX_VALUE
should be returned.getMaximumMessageSizeInBytes
in interface RpcSystemUtils
config
- Flink configurationCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.