org.infinispan.distribution
Class ConsistentHashHelper

java.lang.Object
  extended by org.infinispan.distribution.ConsistentHashHelper

public class ConsistentHashHelper
extends Object

A helper class that handles the construction of consistent hash instances based on configuration.

Since:
4.0
Author:
Manik Surtani

Constructor Summary
ConsistentHashHelper()
           
 
Method Summary
static ConsistentHash createConsistentHash(Class<? extends ConsistentHash> clazz, List<Address> addresses)
          Creates a new consistent hash instance based on the type specified, and populates the consistent hash with the collection of addresses passed in.
static ConsistentHash createConsistentHash(Class<? extends ConsistentHash> clazz, List<Address> addresses, Address... moreAddresses)
          Creates a new consistent hash instance based on the type specified, and populates the consistent hash with the collection of addresses passed in.
static ConsistentHash createConsistentHash(Class<? extends ConsistentHash> clazz, List<Address> addresses, Collection<Address> moreAddresses)
          Creates a new consistent hash instance based on the type specified, and populates the consistent hash with the collection of addresses passed in.
static ConsistentHash createConsistentHash(Configuration c, List<Address> addresses)
          Creates a new consistent hash instance based on the user's configuration, and populates the consistent hash with the collection of addresses passed in.
static ConsistentHash createConsistentHash(Configuration c, List<Address> addresses, Address... moreAddresses)
          Creates a new consistent hash instance based on the user's configuration, and populates the consistent hash with the collection of addresses passed in.
static ConsistentHash createConsistentHash(Configuration c, List<Address> addresses, Collection<Address> moreAddresses)
          Creates a new consistent hash instance based on the user's configuration, and populates the consistent hash with the collection of addresses passed in.
static ConsistentHash removeAddress(ConsistentHash ch, Address toRemove, Configuration c)
          Returns a new consistent hash of the same type with the given address removed.
static UnionConsistentHash removeAddressFromUnionConsistentHash(UnionConsistentHash uch, Address toRemove, Configuration c)
          Creates a new UnionConsistentHash instance based on the old instance, removing the provided address from both target consistent hash instances in the union.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsistentHashHelper

public ConsistentHashHelper()
Method Detail

removeAddress

public static ConsistentHash removeAddress(ConsistentHash ch,
                                           Address toRemove,
                                           Configuration c)
                                    throws IllegalAccessException,
                                           InstantiationException,
                                           ClassNotFoundException
Returns a new consistent hash of the same type with the given address removed.

Parameters:
ch - consistent hash to start with
toRemove - address to remove
c - configuration
Returns:
a new consistent hash instance of the same type
Throws:
ClassNotFoundException - thrown if the consistent hash type cannot be constructed via reflection.
IllegalAccessException - thrown if the consistent hash type cannot be constructed via reflection.
InstantiationException - thrown if the consistent hash type cannot be constructed via reflection.

removeAddressFromUnionConsistentHash

public static UnionConsistentHash removeAddressFromUnionConsistentHash(UnionConsistentHash uch,
                                                                       Address toRemove,
                                                                       Configuration c)
                                                                throws IllegalAccessException,
                                                                       ClassNotFoundException,
                                                                       InstantiationException
Creates a new UnionConsistentHash instance based on the old instance, removing the provided address from both target consistent hash instances in the union.

Parameters:
uch - union consistent hash instance
toRemove - address to remove
c - configuration
Returns:
a new UnionConsistentHash instance
Throws:
ClassNotFoundException - thrown if the consistent hash type cannot be constructed via reflection.
IllegalAccessException - thrown if the consistent hash type cannot be constructed via reflection.
InstantiationException - thrown if the consistent hash type cannot be constructed via reflection.

createConsistentHash

public static ConsistentHash createConsistentHash(Configuration c,
                                                  List<Address> addresses)
                                           throws IllegalAccessException,
                                                  InstantiationException,
                                                  ClassNotFoundException
Creates a new consistent hash instance based on the user's configuration, and populates the consistent hash with the collection of addresses passed in.

Parameters:
c - configuration
addresses - with which to populate the consistent hash
Returns:
a new consistent hash instance
Throws:
ClassNotFoundException - thrown if the consistent hash type cannot be constructed via reflection.
IllegalAccessException - thrown if the consistent hash type cannot be constructed via reflection.
InstantiationException - thrown if the consistent hash type cannot be constructed via reflection.

createConsistentHash

public static ConsistentHash createConsistentHash(Configuration c,
                                                  List<Address> addresses,
                                                  Address... moreAddresses)
                                           throws IllegalAccessException,
                                                  ClassNotFoundException,
                                                  InstantiationException
Creates a new consistent hash instance based on the user's configuration, and populates the consistent hash with the collection of addresses passed in.

Parameters:
c - configuration
addresses - with which to populate the consistent hash
moreAddresses - to add to the list of addresses
Returns:
a new consistent hash instance
Throws:
ClassNotFoundException - thrown if the consistent hash type cannot be constructed via reflection.
IllegalAccessException - thrown if the consistent hash type cannot be constructed via reflection.
InstantiationException - thrown if the consistent hash type cannot be constructed via reflection.

createConsistentHash

public static ConsistentHash createConsistentHash(Configuration c,
                                                  List<Address> addresses,
                                                  Collection<Address> moreAddresses)
                                           throws IllegalAccessException,
                                                  ClassNotFoundException,
                                                  InstantiationException
Creates a new consistent hash instance based on the user's configuration, and populates the consistent hash with the collection of addresses passed in.

Parameters:
c - configuration
addresses - with which to populate the consistent hash
moreAddresses - to add to the list of addresses
Returns:
a new consistent hash instance
Throws:
ClassNotFoundException - thrown if the consistent hash type cannot be constructed via reflection.
IllegalAccessException - thrown if the consistent hash type cannot be constructed via reflection.
InstantiationException - thrown if the consistent hash type cannot be constructed via reflection.

createConsistentHash

public static ConsistentHash createConsistentHash(Class<? extends ConsistentHash> clazz,
                                                  List<Address> addresses)
                                           throws IllegalAccessException,
                                                  InstantiationException,
                                                  ClassNotFoundException
Creates a new consistent hash instance based on the type specified, and populates the consistent hash with the collection of addresses passed in.

Parameters:
clazz - type of the consistent hash to create
addresses - with which to populate the consistent hash
Returns:
a new consistent hash instance
Throws:
ClassNotFoundException - thrown if the consistent hash type cannot be constructed via reflection.
IllegalAccessException - thrown if the consistent hash type cannot be constructed via reflection.
InstantiationException - thrown if the consistent hash type cannot be constructed via reflection.

createConsistentHash

public static ConsistentHash createConsistentHash(Class<? extends ConsistentHash> clazz,
                                                  List<Address> addresses,
                                                  Address... moreAddresses)
                                           throws IllegalAccessException,
                                                  ClassNotFoundException,
                                                  InstantiationException
Creates a new consistent hash instance based on the type specified, and populates the consistent hash with the collection of addresses passed in.

Parameters:
clazz - type of the consistent hash to create
addresses - with which to populate the consistent hash
moreAddresses - to add to the list of addresses
Returns:
a new consistent hash instance
Throws:
ClassNotFoundException - thrown if the consistent hash type cannot be constructed via reflection.
IllegalAccessException - thrown if the consistent hash type cannot be constructed via reflection.
InstantiationException - thrown if the consistent hash type cannot be constructed via reflection.

createConsistentHash

public static ConsistentHash createConsistentHash(Class<? extends ConsistentHash> clazz,
                                                  List<Address> addresses,
                                                  Collection<Address> moreAddresses)
                                           throws IllegalAccessException,
                                                  ClassNotFoundException,
                                                  InstantiationException
Creates a new consistent hash instance based on the type specified, and populates the consistent hash with the collection of addresses passed in.

Parameters:
clazz - type of the consistent hash to create
addresses - with which to populate the consistent hash
moreAddresses - to add to the list of addresses
Returns:
a new consistent hash instance
Throws:
ClassNotFoundException - thrown if the consistent hash type cannot be constructed via reflection.
IllegalAccessException - thrown if the consistent hash type cannot be constructed via reflection.
InstantiationException - thrown if the consistent hash type cannot be constructed via reflection.

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.