public class Ports extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_HOST_SSH_PORT |
static int |
DEFAULT_HTTP_PORT |
static int |
DEFAULT_HTTPS_PORT |
static int |
DEFAULT_KARAF_SSH_PORT |
static int |
DEFAULT_RMI_REGISTRY_PORT |
static int |
DEFAULT_RMI_SERVER_PORT |
static int |
DEFAULT_ZOOKEEPER_ELECTION_PORT |
static int |
DEFAULT_ZOOKEEPER_PEER_PORT |
static int |
DEFAULT_ZOOKEEPER_SERVER_PORT |
static int |
MAX_PORT_NUMBER |
static int |
MIN_PORT_NUMBER |
static String |
PORT_PATTERN |
Modifier and Type | Method and Description |
---|---|
static int |
extractPort(String address)
Extracts the port from an addrees.
|
static int |
findFreeLocalPort(Set<Integer> usedPorts,
int fromPort,
int toPort,
boolean checkIfAvailable)
Finds a the next free local port, based on the list of used ports and the ability to directly check if port is free.
|
static int |
findPort(Map<String,List<Integer>> usedPorts,
String ip,
int port)
Finds a port based on the given ip and the used ports for that ip.
|
static Set<Integer> |
findUsedPorts(int fromPort,
int toPort)
Returns a
Set of used ports within the range. |
static boolean |
isPortFree(int port)
Checks if a local port is free.
|
static int |
mapPortToRange(int port,
int minimumPort,
int maximumPort)
Maps the target port inside a port range.
|
static int |
mapPortToRange(int port,
String minimumPort,
String maximumPort)
Maps the target port inside a port range.
|
public static final int DEFAULT_HOST_SSH_PORT
public static final int DEFAULT_KARAF_SSH_PORT
public static final int DEFAULT_ZOOKEEPER_SERVER_PORT
public static final int DEFAULT_ZOOKEEPER_PEER_PORT
public static final int DEFAULT_ZOOKEEPER_ELECTION_PORT
public static final int DEFAULT_RMI_SERVER_PORT
public static final int DEFAULT_RMI_REGISTRY_PORT
public static final int DEFAULT_HTTP_PORT
public static final int DEFAULT_HTTPS_PORT
public static final int MIN_PORT_NUMBER
public static final int MAX_PORT_NUMBER
public static final String PORT_PATTERN
public static Set<Integer> findUsedPorts(int fromPort, int toPort)
Set
of used ports within the range.fromPort
- toPort
- public static int findPort(Map<String,List<Integer>> usedPorts, String ip, int port)
usedPorts
- ip
- port
- public static int findFreeLocalPort(Set<Integer> usedPorts, int fromPort, int toPort, boolean checkIfAvailable)
usedPorts
- fromPort
- toPort
- checkIfAvailable
- public static int mapPortToRange(int port, int minimumPort, int maximumPort)
port
- minimumPort
- maximumPort
- public static int mapPortToRange(int port, String minimumPort, String maximumPort)
port
- minimumPort
- maximumPort
- public static boolean isPortFree(int port)
port
- public static int extractPort(String address)
address
- Copyright © 2011–2016 Red Hat. All rights reserved.