org.apache.cassandra.utils
Class NodeId

java.lang.Object
  extended by org.apache.cassandra.utils.NodeId
All Implemented Interfaces:
java.lang.Comparable<NodeId>

public class NodeId
extends java.lang.Object
implements java.lang.Comparable<NodeId>


Nested Class Summary
static class NodeId.NodeIdRecord
           
static class NodeId.OneShotRenewer
           
 
Field Summary
static int LENGTH
           
 
Method Summary
 java.nio.ByteBuffer bytes()
           
 int compareTo(NodeId o)
           
 boolean equals(java.lang.Object o)
           
static NodeId fromInt(int n)
          Function for test purposes, do not use otherwise.
static NodeId generate()
           
static NodeId getLocalId()
           
static java.util.List<NodeId.NodeIdRecord> getOldLocalNodeIds()
          Return the list of old local node id of this node.
 int hashCode()
           
 boolean isLocalId()
           
static void renewLocalId()
          Renew the local node id.
 java.lang.String toString()
           
static NodeId wrap(java.nio.ByteBuffer id)
           
static NodeId wrap(java.nio.ByteBuffer bb, int offset)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LENGTH

public static final int LENGTH
See Also:
Constant Field Values
Method Detail

getLocalId

public static NodeId getLocalId()

renewLocalId

public static void renewLocalId()
Renew the local node id. To use only when this strictly necessary, as using this will make all counter context grow with time.


getOldLocalNodeIds

public static java.util.List<NodeId.NodeIdRecord> getOldLocalNodeIds()
Return the list of old local node id of this node. It is guaranteed that the returned list is sorted by growing node id (and hence the first item will be the oldest node id for this host)


fromInt

public static NodeId fromInt(int n)
Function for test purposes, do not use otherwise. Pack an int in a valid NodeId so that the resulting ids respects the numerical ordering. Used for creating handcrafted but easy to understand contexts in unit tests (see CounterContextTest).


wrap

public static NodeId wrap(java.nio.ByteBuffer id)

wrap

public static NodeId wrap(java.nio.ByteBuffer bb,
                          int offset)

generate

public static NodeId generate()

bytes

public java.nio.ByteBuffer bytes()

isLocalId

public boolean isLocalId()

compareTo

public int compareTo(NodeId o)
Specified by:
compareTo in interface java.lang.Comparable<NodeId>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2011 The Apache Software Foundation