|
Infinispan Distribution 5.2.6.Final-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.distribution.ch.ReplicatedConsistentHash
public class ReplicatedConsistentHash
Special implementation of ConsistentHash
for replicated caches.
The hash-space has only one segment owned by all members.
Nested Class Summary | |
---|---|
static class |
ReplicatedConsistentHash.Externalizer
|
Constructor Summary | |
---|---|
ReplicatedConsistentHash(List<Address> members)
|
Method Summary | |
---|---|
Hash |
getHashFunction()
|
List<Address> |
getMembers()
Should return the addresses of the nodes used to create this consistent hash. |
int |
getNumOwners()
|
int |
getNumSegments()
|
String |
getRoutingTableAsString()
Returns a string containing all the segments and their associated addresses. |
int |
getSegment(Object key)
|
Set<Integer> |
getSegmentsForOwner(Address owner)
Returns the segments owned by a cache member. |
boolean |
isKeyLocalToNode(Address nodeAddress,
Object key)
Test to see whether a key is owned by a given node. |
Set<Address> |
locateAllOwners(Collection<Object> keys)
The logical equivalent of calling ConsistentHash.locateOwners(java.lang.Object) multiple times for each key in the collection of
keys and merging the results. |
List<Address> |
locateOwners(Object key)
Finds all the owners of a key. |
List<Address> |
locateOwnersForSegment(int segmentId)
|
Address |
locatePrimaryOwner(Object key)
Should be equivalent to return the first element of ConsistentHash.locateOwners(java.lang.Object) . |
Address |
locatePrimaryOwnerForSegment(int segmentId)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ReplicatedConsistentHash(List<Address> members)
Method Detail |
---|
public int getNumSegments()
getNumSegments
in interface ConsistentHash
public int getNumOwners()
getNumOwners
in interface ConsistentHash
public List<Address> getMembers()
ConsistentHash
getMembers
in interface ConsistentHash
public Hash getHashFunction()
getHashFunction
in interface ConsistentHash
public int getSegment(Object key)
getSegment
in interface ConsistentHash
public List<Address> locateOwnersForSegment(int segmentId)
locateOwnersForSegment
in interface ConsistentHash
public Address locatePrimaryOwnerForSegment(int segmentId)
locatePrimaryOwnerForSegment
in interface ConsistentHash
locateOwnersForSegment(segmentId).get(0)
but is more efficientpublic Set<Integer> getSegmentsForOwner(Address owner)
ConsistentHash
getSegmentsForOwner
in interface ConsistentHash
owner
- the address of the member
public String getRoutingTableAsString()
ConsistentHash
getRoutingTableAsString
in interface ConsistentHash
public Address locatePrimaryOwner(Object key)
ConsistentHash
ConsistentHash.locateOwners(java.lang.Object)
.
Useful as a performance optimization, as this is a frequently needed information.
locatePrimaryOwner
in interface ConsistentHash
key
- key to locate
public List<Address> locateOwners(Object key)
ConsistentHash
locateOwners
in interface ConsistentHash
key
- key to locate
null
, and it will always have at least 1 element.public Set<Address> locateAllOwners(Collection<Object> keys)
ConsistentHash
ConsistentHash.locateOwners(java.lang.Object)
multiple times for each key in the collection of
keys and merging the results. Implementations may be optimised for such a bulk lookup.
locateAllOwners
in interface ConsistentHash
keys
- keys to locate.
public boolean isKeyLocalToNode(Address nodeAddress, Object key)
ConsistentHash
isKeyLocalToNode
in interface ConsistentHash
nodeAddress
- address of the node to testkey
- key to test
true
if the key is mapped to the address; false
otherwisepublic String toString()
toString
in class Object
|
Infinispan Distribution 5.2.6.Final-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |