Package org.apache.flink.runtime.rpc
Class CleanupOnCloseRpcSystem
- java.lang.Object
-
- org.apache.flink.runtime.rpc.CleanupOnCloseRpcSystem
-
- All Implemented Interfaces:
AutoCloseable,RpcSystem,RpcSystemUtils
public class CleanupOnCloseRpcSystem extends Object implements RpcSystem
AnRpcSystemwrapper that cleans up resources after the RPC system has been closed.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.rpc.RpcSystem
RpcSystem.FixedThreadPoolExecutorConfiguration, RpcSystem.ForkJoinExecutorConfiguration, RpcSystem.RpcServiceBuilder
-
-
Constructor Summary
Constructors Constructor Description CleanupOnCloseRpcSystem(RpcSystem rpcSystem, org.apache.flink.core.classloading.SubmoduleClassLoader pluginLoader, Path tempDirectory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Hook to cleanup resources, like common thread pools or classloaders.InetSocketAddressgetInetSocketAddressFromRpcUrl(String url)Returns anInetSocketAddresscorresponding to the given RPC url.longgetMaximumMessageSizeInBytes(org.apache.flink.configuration.Configuration config)Returns the maximum number of bytes that an RPC message may carry according to the given configuration.StringgetRpcUrl(String hostname, int port, String endpointName, AddressResolution addressResolution, org.apache.flink.configuration.Configuration config)Constructs an RPC URL for the given parameters, that can be used to connect to the targeted RpcService.RpcSystem.RpcServiceBuilderlocalServiceBuilder(org.apache.flink.configuration.Configuration config)Returns a builder for anRpcServicethat is only reachable from the local machine.RpcSystem.RpcServiceBuilderremoteServiceBuilder(org.apache.flink.configuration.Configuration configuration, String externalAddress, String externalPortRange)Returns a builder for anRpcServicethat is reachable from other machines.
-
-
-
Method Detail
-
close
public void close()
Description copied from interface:RpcSystemHook to cleanup resources, like common thread pools or classloaders.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRpcSystem
-
localServiceBuilder
public RpcSystem.RpcServiceBuilder localServiceBuilder(org.apache.flink.configuration.Configuration config)
Description copied from interface:RpcSystemReturns a builder for anRpcServicethat is only reachable from the local machine.- Specified by:
localServiceBuilderin interfaceRpcSystem- Parameters:
config- Flink configuration- Returns:
- rpc service builder
-
remoteServiceBuilder
public RpcSystem.RpcServiceBuilder remoteServiceBuilder(org.apache.flink.configuration.Configuration configuration, @Nullable String externalAddress, String externalPortRange)
Description copied from interface:RpcSystemReturns a builder for anRpcServicethat is reachable from other machines.- Specified by:
remoteServiceBuilderin interfaceRpcSystem- Parameters:
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 reachable- Returns:
- rpc service builder
-
getRpcUrl
public String getRpcUrl(String hostname, int port, String endpointName, AddressResolution addressResolution, org.apache.flink.configuration.Configuration config) throws UnknownHostException
Description copied from interface:RpcSystemUtilsConstructs an RPC URL for the given parameters, that can be used to connect to the targeted RpcService.- Specified by:
getRpcUrlin interfaceRpcSystemUtils- Parameters:
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.- Returns:
- The RPC URL of the specified RPC endpoint.
- Throws:
UnknownHostException
-
getInetSocketAddressFromRpcUrl
public InetSocketAddress getInetSocketAddressFromRpcUrl(String url) throws Exception
Description copied from interface:RpcSystemUtilsReturns anInetSocketAddresscorresponding to the given RPC url.- Specified by:
getInetSocketAddressFromRpcUrlin interfaceRpcSystemUtils- Parameters:
url- RPC url- Returns:
- inet socket address
- Throws:
Exception- if the URL is invalid- See Also:
RpcSystemUtils.getRpcUrl(java.lang.String, int, java.lang.String, org.apache.flink.runtime.rpc.AddressResolution, org.apache.flink.configuration.Configuration)
-
getMaximumMessageSizeInBytes
public long getMaximumMessageSizeInBytes(org.apache.flink.configuration.Configuration config)
Description copied from interface:RpcSystemUtilsReturns the maximum number of bytes that an RPC message may carry according to the given configuration. If no limit exists thenLong.MAX_VALUEshould be returned.- Specified by:
getMaximumMessageSizeInBytesin interfaceRpcSystemUtils- Parameters:
config- Flink configuration- Returns:
- maximum number of bytes that an RPC message may carry
-
-