本文整理了Java中brooklyn.util.net.Networking.isPortAvailable()
方法的一些代码示例,展示了Networking.isPortAvailable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Networking.isPortAvailable()
方法的具体详情如下:
包路径:brooklyn.util.net.Networking
类名称:Networking
方法名:isPortAvailable
暂无
代码示例来源:origin: io.brooklyn/brooklyn-utils-common
/** returns the first port available on the local machine >= the port supplied */
public static int nextAvailablePort(int port) {
while (!isPortAvailable(port)) port++;
return port;
}
代码示例来源:origin: io.brooklyn/brooklyn-utils-common
public static boolean isPortAvailable(int port) {
try {
return isPortAvailable(InetAddress.getByName("localhost"), port);
} catch (UnknownHostException e) {
if (!loggedLocalhostNotAvailable) {
loggedLocalhostNotAvailable = true;
log.warn("localhost unavailable during port availability check for "+port+": "+e+"; ignoring, but this may be a sign of network misconfiguration");
}
return isPortAvailable(null, port);
}
}
public static boolean isPortAvailable(InetAddress localAddress, int port) {
代码示例来源:origin: io.brooklyn/brooklyn-core
/** checks the actual availability of the port on localhost, ie by binding to it; cf {@link Networking#isPortAvailable(int)} */
public static boolean checkPortAvailable(InetAddress localAddress, int portNumber) {
if (portNumber<1024) {
if (LOG.isDebugEnabled()) LOG.debug("Skipping system availability check for privileged localhost port "+portNumber);
return true;
}
return Networking.isPortAvailable(portNumber);
}
public static int obtainPort(PortRange range) {
内容来源于网络,如有侵权,请联系作者删除!