|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.spy.memcached.util.DefaultKetamaNodeLocatorConfiguration
public class DefaultKetamaNodeLocatorConfiguration
A Default implementation of the configuration required for the KetamaNodeLocator algorithm to run.
Field Summary | |
---|---|
protected Map<MemcachedNode,String> |
socketAddresses
|
Constructor Summary | |
---|---|
DefaultKetamaNodeLocatorConfiguration()
|
Method Summary | |
---|---|
String |
getKeyForNode(MemcachedNode node,
int repetition)
Returns a uniquely identifying key, suitable for hashing by the KetamaNodeLocator algorithm. |
int |
getNodeRepetitions()
Returns the number of discrete hashes that should be defined for each node in the continuum. |
protected String |
getSocketAddressForNode(MemcachedNode node)
Returns the socket address of a given MemcachedNode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<MemcachedNode,String> socketAddresses
Constructor Detail |
---|
public DefaultKetamaNodeLocatorConfiguration()
Method Detail |
---|
protected String getSocketAddressForNode(MemcachedNode node)
node
- The node which we're interested in
public int getNodeRepetitions()
getNodeRepetitions
in interface KetamaNodeLocatorConfiguration
public String getKeyForNode(MemcachedNode node, int repetition)
This default implementation uses the socket-address of the MemcachedNode and concatenates it with a hyphen directly against the repetition number for example a key for a particular server's first repetition may look like:
myhost/10.0.2.1-0
for the second repetition
myhost/10.0.2.1-1
for a server where reverse lookups are failing the returned keys may look like
/10.0.2.1-0
and /10.0.2.1-1
getKeyForNode
in interface KetamaNodeLocatorConfiguration
node
- The MemcachedNode to use to form the unique identifierrepetition
- The repetition number for the particular node in
question (0 is the first repetition)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |