org.axonframework.commandhandling.distributed
Class ConsistentHash.Member

java.lang.Object
  extended by org.axonframework.commandhandling.distributed.ConsistentHash.Member
Enclosing class:
ConsistentHash

public static class ConsistentHash.Member
extends Object

Represents a member in a consistently hashed cluster. A member is identified by its name, supports a number of commands and can have any number of segments (a.k.a buckets).

Note that a single member may be presented by multiple Member instances if the number of segments differs per supported command type.

Author:
Allard Buijze

Constructor Summary
ConsistentHash.Member(String nodeName, int segmentCount, Set<String> supportedCommandTypes)
          Constructs a new member with given nodeName, segmentCount supporting given supportedCommandTypes.
 
Method Summary
 boolean equals(Object o)
           
 int hashCode()
           
 Set<String> hashes()
          Returns the hash values assigned to this member.
 String name()
          Returns the name of this member.
 int segmentCount()
          Returns the number of segments this member has on the consistent hash ring.
 Set<String> supportedCommands()
          Returns the set of commands supported by this member.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsistentHash.Member

public ConsistentHash.Member(String nodeName,
                             int segmentCount,
                             Set<String> supportedCommandTypes)
Constructs a new member with given nodeName, segmentCount supporting given supportedCommandTypes.

Parameters:
nodeName - The name of the node
segmentCount - The number of segments the node should have on the hash ring
supportedCommandTypes - The commands supported by this node
Method Detail

name

public String name()
Returns the name of this member. Members are typically uniquely identified by their name.

Note that a single member may be presented by multiple Member instances if the number of segments differs per supported command type. Therefore, the name should not be considered an absolutely unique value.

Returns:
the name of this member

supportedCommands

public Set<String> supportedCommands()
Returns the set of commands supported by this member.

Returns:
the set of commands supported by this member

segmentCount

public int segmentCount()
Returns the number of segments this member has on the consistent hash ring. Depending on the spread of the hashing algorithm used (default MD5), this number is an indication of the load of this node compared to other nodes.

Returns:
the number of segments this member has on the consistent hash ring

hashes

public Set<String> hashes()
Returns the hash values assigned to this member. These values are used to locate the member to handle any given command.

Returns:
the hash values assigned to this member

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2010-2016. All Rights Reserved.