public class NetUtils extends Object
| Constructor and Description |
|---|
NetUtils() |
| Modifier and Type | Method and Description |
|---|---|
static InetAddress |
findConnectingAddress(InetSocketAddress targetAddress,
long maxWaitMillis,
long startLoggingAfter)
Finds the local network address from which this machine can connect to the target
address.
|
static int |
getAvailablePort()
Find a non-occupied port.
|
static InetAddress |
resolveAddress(InetSocketAddress jobManagerAddress)
Find out the TaskManager's own IP address, simple version.
|
public static InetAddress resolveAddress(InetSocketAddress jobManagerAddress) throws IOException
IOExceptionpublic static InetAddress findConnectingAddress(InetSocketAddress targetAddress, long maxWaitMillis, long startLoggingAfter) throws IOException
If no connection attempt was successful after the given maximum time, the method will choose some address based on heuristics (excluding link-local and loopback addresses.)
This method will initially not log on info level (to not flood the log while the backoff time is still very low). It will start logging after a certain time has passes.
targetAddress - The address that the method tries to connect to.maxWaitMillis - The maximum time that this method tries to connect, before falling
back to the heuristics.startLoggingAfter - The time after which the method will log on INFO level.IOExceptionpublic static int getAvailablePort()
Copyright © 2014–2015 The Apache Software Foundation. All rights reserved.