Package org.jgroups.util
Class ResourceManager
- java.lang.Object
-
- org.jgroups.util.ResourceManager
-
public final class ResourceManager extends java.lang.ObjectManages resources such as multicast addresses and multicast ports, and TCP ports. This class is mainly used for running unit tests in parallel (TestNG) and preventing clusters intended to be separate from joining each other.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceResourceManager.IpAddressRep(package private) static classResourceManager.IPv4AddressRepRepresentation of an IPv4 address(package private) static classResourceManager.IPv6AddressRepRepresentation of an IPv6 address
-
Field Summary
Fields Modifier and Type Field Description private static shortmcast_portprivate static ResourceManager.IpAddressReprepprivate static SocketFactorysocket_factoryprivate static inttcp_port
-
Constructor Summary
Constructors Modifier Constructor Description privateResourceManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetNextMulticastAddress()Returns the next available multicast address, e.g.static shortgetNextMulticastPort(java.net.InetAddress bind_addr)static intgetNextTcpPort(java.net.InetAddress bind_addr)private static intgetNextTCPPort(java.net.InetAddress bind_addr, int start_port)static java.util.List<java.lang.Integer>getNextTcpPorts(java.net.InetAddress bind_addr, int num_requested_ports)static voidmain(java.lang.String[] args)
-
-
-
Field Detail
-
rep
private static final ResourceManager.IpAddressRep rep
-
mcast_port
private static short mcast_port
-
tcp_port
private static int tcp_port
-
socket_factory
private static final SocketFactory socket_factory
-
-
Method Detail
-
getNextMulticastAddress
public static java.lang.String getNextMulticastAddress()
Returns the next available multicast address, e.g. "239.1.2.3". This class is a JVM singleton- Returns:
-
getNextMulticastPort
public static short getNextMulticastPort(java.net.InetAddress bind_addr) throws java.lang.Exception- Throws:
java.lang.Exception
-
getNextTcpPorts
public static java.util.List<java.lang.Integer> getNextTcpPorts(java.net.InetAddress bind_addr, int num_requested_ports) throws java.lang.Exception- Throws:
java.lang.Exception
-
getNextTcpPort
public static int getNextTcpPort(java.net.InetAddress bind_addr) throws java.lang.Exception- Throws:
java.lang.Exception
-
getNextTCPPort
private static int getNextTCPPort(java.net.InetAddress bind_addr, int start_port) throws java.lang.Exception- Throws:
java.lang.Exception
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
-