@Override protected Object defaultValue() { return new VmPipeAddress(0); }
@Override protected String toText(Object value) { return ":" + ((VmPipeAddress) value).getPort(); }
for (SocketAddress a : localAddresses) { VmPipeAddress localAddress = (VmPipeAddress) a; if (localAddress == null || localAddress.getPort() == 0) { localAddress = null; for (int i = 10000; i < Integer.MAX_VALUE; i++) { VmPipeAddress newLocalAddress = new VmPipeAddress(i); if (!boundHandlers.containsKey(newLocalAddress) && !newLocalAddresses.contains(newLocalAddress)) { localAddress = newLocalAddress; throw new IOException("No port available."); } else if (localAddress.getPort() < 0) { throw new IOException("Bind port number must be 0 or above."); } else if (boundHandlers.containsKey(localAddress)) {
for (SocketAddress a : localAddresses) { VmPipeAddress localAddress = (VmPipeAddress) a; if (localAddress == null || localAddress.getPort() == 0) { localAddress = null; for (int i = 10000; i < Integer.MAX_VALUE; i++) { VmPipeAddress newLocalAddress = new VmPipeAddress(i); if (!boundHandlers.containsKey(newLocalAddress) && !newLocalAddresses.contains(newLocalAddress)) { localAddress = newLocalAddress; throw new IOException("No port available."); } else if (localAddress.getPort() < 0) { throw new IOException("Bind port number must be 0 or above."); } else if (boundHandlers.containsKey(localAddress)) {
@Override protected Object defaultValue() { return new VmPipeAddress(0); }
for (SocketAddress a: localAddresses) { VmPipeAddress localAddress = (VmPipeAddress) a; if (localAddress == null || localAddress.getPort() == 0) { localAddress = null; for (int i = 10000; i < Integer.MAX_VALUE; i++) { VmPipeAddress newLocalAddress = new VmPipeAddress(i); if (!boundHandlers.containsKey(newLocalAddress) && !newLocalAddresses.contains(newLocalAddress)) { throw new IOException("No port available."); } else if (localAddress.getPort() < 0) { throw new IOException("Bind port number must be 0 or above."); } else if (boundHandlers.containsKey(localAddress)) {
@Override protected String toText(Object value) { return ":" + ((VmPipeAddress) value).getPort(); }
@Override protected Object toValue(String text) throws IllegalArgumentException { if (text.startsWith(":")) { text = text.substring(1); } try { return new VmPipeAddress(Integer.parseInt(text.trim())); } catch (NumberFormatException nfe) { throw new IllegalArgumentException("Illegal VmPipeAddress: " + text); } } }
@Override protected Object toValue(String text) throws IllegalArgumentException { if (text.startsWith(":")) { text = text.substring(1); } try { return new VmPipeAddress(Integer.parseInt(text.trim())); } catch (NumberFormatException nfe) { throw new IllegalArgumentException("Illegal VmPipeAddress: " + text); } } }
private static VmPipeAddress nextLocalAddress() throws IOException { synchronized (TAKEN_LOCAL_ADDRESSES) { if (nextLocalPort >= 0) { nextLocalPort = -1; } for (int i = 0; i < Integer.MAX_VALUE; i++) { VmPipeAddress answer = new VmPipeAddress(nextLocalPort--); if (!TAKEN_LOCAL_ADDRESSES.contains(answer)) { TAKEN_LOCAL_ADDRESSES.add(answer); return answer; } } } throw new IOException("Can't assign a local VM pipe port."); }
private static VmPipeAddress nextLocalAddress() throws IOException { synchronized (TAKEN_LOCAL_ADDRESSES) { if (nextLocalPort >= 0) { nextLocalPort = -1; } for (int i = 0; i < Integer.MAX_VALUE; i++) { VmPipeAddress answer = new VmPipeAddress(nextLocalPort--); if (!TAKEN_LOCAL_ADDRESSES.contains(answer)) { TAKEN_LOCAL_ADDRESSES.add(answer); return answer; } } } throw new IOException("Can't assign a local VM pipe port."); }
private static VmPipeAddress nextLocalAddress() throws IOException { synchronized (TAKEN_LOCAL_ADDRESSES) { if (nextLocalPort >= 0) { nextLocalPort = -1; } for (int i = 0; i < Integer.MAX_VALUE; i++) { VmPipeAddress answer = new VmPipeAddress(nextLocalPort--); if (!TAKEN_LOCAL_ADDRESSES.contains(answer)) { TAKEN_LOCAL_ADDRESSES.add(answer); return answer; } } } throw new IOException("Can't assign a local VM pipe port."); }
public static SocketAddress createSocketAddress(int transportType, String host, int port) throws ConfigError { if (transportType == SOCKET || transportType == PROXY) { return host != null ? new InetSocketAddress(host, port) : new InetSocketAddress(port); } else if (transportType == VM_PIPE) { return new VmPipeAddress(port); } else { throw new ConfigError("Unknown session transport type: " + transportType); } }
public static SocketAddress createSocketAddress(int transportType, String host, int port) throws ConfigError { if (transportType == SOCKET || transportType == PROXY) { return host != null ? new InetSocketAddress(host, port) : new InetSocketAddress(port); } else if (transportType == VM_PIPE) { return new VmPipeAddress(port); } else { throw new ConfigError("Unknown session transport type: " + transportType); } }
public static SocketAddress createSocketAddress(int transportType, String host, int port) throws ConfigError { if (transportType == SOCKET || transportType == PROXY) { return host != null ? new InetSocketAddress(host, port) : new InetSocketAddress(port); } else if (transportType == VM_PIPE) { return new VmPipeAddress(port); } else { throw new ConfigError("Unknown session transport type: " + transportType); } }