public class ConnectionUtils extends Object
|Modifier and Type||Class and Description|
|Constructor and Description|
|Modifier and Type||Method and Description|
Finds the local network address from which this machine can connect to the target address.
public 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.
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.