com.aerospike.client.cluster
Class Node

java.lang.Object
  extended by com.aerospike.client.cluster.Node
Direct Known Subclasses:
AsyncNode

public class Node
extends Object

Server node representation. This class manages server node connections and health status.


Field Summary
static int PARTITIONS
          Number of partitions for each namespace.
 
Constructor Summary
Node(com.aerospike.client.cluster.Cluster cluster, com.aerospike.client.cluster.NodeValidator nv)
          Initialize server node with connection parameters.
 
Method Summary
 void addAlias(Host aliasToAdd)
          Add node alias to list.
 void close()
          Close all server node socket connections.
 void decreaseHealth()
          Decrease server health status after a connection failure.
 boolean equals(Object obj)
           
 Host[] getAliases()
          Return server node IP address aliases.
 com.aerospike.client.cluster.Connection getConnection(int timeoutMillis)
          Get a socket connection from connection pool to the server node.
 Host getHost()
          Return server node IP address and port.
 String getName()
          Return server node name.
 int hashCode()
           
 boolean isActive()
          Return whether node is currently active.
 boolean isUnhealthy()
          Has consecutive node connection errors become critical.
 void putConnection(com.aerospike.client.cluster.Connection conn)
          Put connection back into connection pool.
 void refresh(List<Host> friends)
          Request current status from server node.
 void restoreHealth()
          Set node status as healthy after successful database operation.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PARTITIONS

public static final int PARTITIONS
Number of partitions for each namespace.

See Also:
Constant Field Values
Constructor Detail

Node

public Node(com.aerospike.client.cluster.Cluster cluster,
            com.aerospike.client.cluster.NodeValidator nv)
Initialize server node with connection parameters.

Parameters:
cluster - collection of active server nodes
nv - connection parameters
Method Detail

refresh

public final void refresh(List<Host> friends)
                   throws Exception
Request current status from server node.

Parameters:
friends - other nodes in the cluster, populated by this method
Throws:
Exception - if status request fails

getConnection

public final com.aerospike.client.cluster.Connection getConnection(int timeoutMillis)
                                                            throws AerospikeException.Connection
Get a socket connection from connection pool to the server node.

Parameters:
timeoutMillis - connection timeout value in milliseconds if a new connection is created
Returns:
socket connection
Throws:
AerospikeException - if a connection could not be provided
AerospikeException.Connection

putConnection

public final void putConnection(com.aerospike.client.cluster.Connection conn)
Put connection back into connection pool.

Parameters:
conn - socket connection

restoreHealth

public final void restoreHealth()
Set node status as healthy after successful database operation.


decreaseHealth

public final void decreaseHealth()
Decrease server health status after a connection failure.


isUnhealthy

public final boolean isUnhealthy()
Has consecutive node connection errors become critical.


getHost

public final Host getHost()
Return server node IP address and port.


isActive

public final boolean isActive()
Return whether node is currently active.


getName

public final String getName()
Return server node name.


getAliases

public final Host[] getAliases()
Return server node IP address aliases.


addAlias

public final void addAlias(Host aliasToAdd)
Add node alias to list.


close

public final void close()
Close all server node socket connections.


toString

public final String toString()
Overrides:
toString in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

equals

public final boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012–2014 Aerospike, Inc. All rights reserved.