public final class AvailablePortFinder extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_PORT_NUMBER
The maximum server currentMinPort number for IPv4.
|
static int |
MIN_PORT_NUMBER
The minimum server currentMinPort number for IPv4.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
available(int port)
Checks to see if a specific port is available.
|
static int |
getNextAvailable()
Gets the next available port starting at the lowest port number.
|
static int |
getNextAvailable(int fromPort)
Gets the next available port starting at a port.
|
public static final int MIN_PORT_NUMBER
public static final int MAX_PORT_NUMBER
public static int getNextAvailable()
NoSuchElementException
- if there are no ports availablepublic static int getNextAvailable(int fromPort)
fromPort
- the port to scan for availabilityNoSuchElementException
- if there are no ports availablepublic static boolean available(int port)
port
- the port to check for availabilityApache Camel