private static boolean testOneInterface(InetAddress addr, int port) { Keeper k = keepOneInterface(addr, port); if (k != null) { k.release(); return true; } else { return false; } } private static Keeper keepOneInterface(InetAddress addr, int port) {
private static boolean testOneInterface(InetAddress addr, int port) { Keeper k = keepOneInterface(addr, port); if (k != null) { k.release(); return true; } else { return false; } } private static Keeper keepOneInterface(InetAddress addr, int port) {
public static Keeper isPortKeepable(final int port, int protocol, InetAddress addr) { if (protocol == SOCKET) { // Try to create a ServerSocket if(addr == null) { return keepAllInterfaces(port); } else { return keepOneInterface(addr, port); } } else if (protocol == MULTICAST) { throw new IllegalArgumentException("You can not keep the JGROUPS protocol"); } else { throw new IllegalArgumentException(LocalizedStrings.AvailablePort_UNKNOWN_PROTOCOL_0.toLocalizedString(Integer.valueOf(protocol))); } }
public static Keeper isPortKeepable(final int port, int protocol, InetAddress addr) { if (protocol == SOCKET) { // Try to create a ServerSocket if(addr == null) { return keepAllInterfaces(port); } else { return keepOneInterface(addr, port); } } else if (protocol == JGROUPS) { throw new IllegalArgumentException("You can not keep the JGROUPS protocol"); } else { throw new IllegalArgumentException(LocalizedStrings.AvailablePort_UNKNOWN_PROTOCOL_0.toLocalizedString(Integer.valueOf(protocol))); } }
return keepOneInterface(null, port);
return keepOneInterface(null, port);