org.jgroups.util
Class ResourceManager

java.lang.Object
  extended by org.jgroups.util.ResourceManager

public class ResourceManager
extends java.lang.Object

Manages 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.

Author:
Bela Ban

Nested Class Summary
static interface ResourceManager.IpAddressRep
           
 
Method Summary
static java.lang.String getNextMulticastAddress()
          Returns the next available multicast address, e.g.
static short getNextMulticastPort(java.net.InetAddress bind_addr)
           
static short getNextTcpPort(java.net.InetAddress bind_addr)
           
static java.util.List<java.lang.Short> getNextTcpPorts(java.net.InetAddress bind_addr, int num_requested_ports)
           
static java.lang.String getUniqueClusterName()
           
static java.lang.String getUniqueClusterName(java.lang.String base_name)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNextMulticastAddress

public static java.lang.String getNextMulticastAddress()
Returns the next available multicast address, e.g. "228.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.Short> getNextTcpPorts(java.net.InetAddress bind_addr,
                                                              int num_requested_ports)
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

getNextTcpPort

public static short getNextTcpPort(java.net.InetAddress bind_addr)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getUniqueClusterName

public static java.lang.String getUniqueClusterName(java.lang.String base_name)

getUniqueClusterName

public static java.lang.String getUniqueClusterName()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.