public class PortHelper extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_PORT_NUMBER |
static int |
MIN_PORT_NUMBER |
static int |
START_PORT_NUMBER |
Constructor and Description |
---|
PortHelper() |
Modifier and Type | Method and Description |
---|---|
int |
getNextAvailable()
Gets the next available port that is higher than all other port numbers issued
thus far.
|
int |
getNextAvailable(int fromPort)
Gets the next available port starting from given point.
|
boolean |
isPortAvailable(int port) |
void |
setTimeout(int timeout) |
void |
waitUntilAllocatedPortsAreFree()
Tests that all ports allocated by getNextAvailable are free.
|
void |
waitUntilPortsAreFree(Set<Integer> ports) |
public static final int START_PORT_NUMBER
public static final int MIN_PORT_NUMBER
public static final int MAX_PORT_NUMBER
public int getNextAvailable(int fromPort)
fromPort
- the port to scan for availabilityNoSuchElementException
- if there are no ports availablepublic int getNextAvailable()
NoSuchElementException
- if there are no ports availablepublic void waitUntilAllocatedPortsAreFree()
public boolean isPortAvailable(int port)
public void setTimeout(int timeout)
Copyright © 2006–2016 The Apache Software Foundation. All rights reserved.