Class HashConfiguration
- java.lang.Object
-
- org.infinispan.configuration.cache.HashConfiguration
-
- All Implemented Interfaces:
Matchable<HashConfiguration>
,BaseConfigurationInfo
,ConfigurationInfo
public class HashConfiguration extends java.lang.Object implements Matchable<HashConfiguration>, ConfigurationInfo
Allows fine-tuning of rehashing characteristics. Must only used with 'distributed' cache mode.- Author:
- pmuir
-
-
Field Summary
Fields Modifier and Type Field Description static AttributeDefinition<java.lang.Float>
CAPACITY_FACTOR
static AttributeDefinition<ConsistentHashFactory>
CONSISTENT_HASH_FACTORY
static ElementDefinition
ELEMENT_DEFINITION
static AttributeDefinition<KeyPartitioner>
KEY_PARTITIONER
static AttributeDefinition<java.lang.Integer>
NUM_OWNERS
static AttributeDefinition<java.lang.Integer>
NUM_SEGMENTS
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeSet
attributes()
float
capacityFactor()
Controls the proportion of entries that will reside on the local node, compared to the other nodes in the cluster.ConsistentHashFactory<?>
consistentHashFactory()
The consistent hash factory in use.boolean
equals(java.lang.Object obj)
ElementDefinition
getElementDefinition()
GroupsConfiguration
groups()
Configuration for various grouper definitions.int
hashCode()
KeyPartitioner
keyPartitioner()
boolean
matches(HashConfiguration other)
int
numOwners()
Number of cluster-wide replicas for each cache entry.int
numSegments()
Controls the total number of hash space segments (per cluster).java.util.List<ConfigurationInfo>
subElements()
java.lang.String
toString()
-
-
-
Field Detail
-
CONSISTENT_HASH_FACTORY
public static final AttributeDefinition<ConsistentHashFactory> CONSISTENT_HASH_FACTORY
-
NUM_OWNERS
public static final AttributeDefinition<java.lang.Integer> NUM_OWNERS
-
NUM_SEGMENTS
public static final AttributeDefinition<java.lang.Integer> NUM_SEGMENTS
-
CAPACITY_FACTOR
public static final AttributeDefinition<java.lang.Float> CAPACITY_FACTOR
-
KEY_PARTITIONER
public static final AttributeDefinition<KeyPartitioner> KEY_PARTITIONER
-
ELEMENT_DEFINITION
public static final ElementDefinition ELEMENT_DEFINITION
-
-
Method Detail
-
consistentHashFactory
public ConsistentHashFactory<?> consistentHashFactory()
The consistent hash factory in use.
-
numOwners
public int numOwners()
Number of cluster-wide replicas for each cache entry.
-
numSegments
public int numSegments()
Controls the total number of hash space segments (per cluster).A hash space segment is the granularity for key distribution in the cluster: a node can own (or primary-own) one or more full segments, but not a fraction of a segment. As such, larger
numSegments
values will mean a more even distribution of keys between nodes.On the other hand, the memory/bandwidth usage of the new consistent hash grows linearly with
numSegments
. So we recommend keepingnumSegments <= 10 * clusterSize
.
-
capacityFactor
public float capacityFactor()
Controls the proportion of entries that will reside on the local node, compared to the other nodes in the cluster. This is just a suggestion, there is no guarantee that a node with a capacity factor of2
will have twice as many entries as a node with a capacity factor of1
.
-
keyPartitioner
public KeyPartitioner keyPartitioner()
-
groups
public GroupsConfiguration groups()
Configuration for various grouper definitions. See the user guide for more information.
-
attributes
public AttributeSet attributes()
- Specified by:
attributes
in interfaceBaseConfigurationInfo
- Returns:
- the
AttributeSet
declared by the configuration.
-
getElementDefinition
public ElementDefinition getElementDefinition()
- Specified by:
getElementDefinition
in interfaceBaseConfigurationInfo
- Returns:
- the
ElementDefinition
of the configuration.
-
subElements
public java.util.List<ConfigurationInfo> subElements()
- Specified by:
subElements
in interfaceConfigurationInfo
- Returns:
- the list of sub elements.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
matches
public boolean matches(HashConfiguration other)
- Specified by:
matches
in interfaceMatchable<HashConfiguration>
-
-