org.scale7.cassandra.pelops
Class Cluster

java.lang.Object
  extended by org.scale7.cassandra.pelops.Cluster

public class Cluster
extends Object

A heavy thread safe object that maintains a list of nodes in the cluster. It's intended that one instance of the class be available in the JVM per cluster.


Nested Class Summary
static class Cluster.AcceptAllNodeFilter
          Default implementation that accepts all nodes.
static interface Cluster.INodeFilter
          A filter used to determine which nodes should be used when refreshing.
static class Cluster.Node
          Represents a node in the cluster.
 
Constructor Summary
Cluster(String[] nodes, IConnection.Config connectionConfig, boolean dynamicNodeDiscovery)
           
Cluster(String[] nodes, IConnection.Config connectionConfig, boolean dynamicNodeDiscovery, Cluster.INodeFilter nodeFilter)
           
Cluster(String nodes, IConnection.Config connectionConfig, boolean dynamicNodeDiscovery)
           
Cluster(String nodes, IConnection.Config connectionConfig, boolean dynamicNodeDiscovery, Cluster.INodeFilter nodeFilter)
           
Cluster(String nodes, int thriftPort)
           
Cluster(String nodes, int thriftPort, boolean dynamicNodeDiscovery)
           
 
Method Summary
 IConnection.Config getConnectionConfig()
          Configuration used to open new connections.
 Cluster.Node[] getNodes()
          The current list of available nodes.
 void refresh()
          Refresh the current list of nodes.
 void refresh(String keyspace)
          Refresh the current list of nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cluster

public Cluster(String nodes,
               int thriftPort)

Cluster

public Cluster(String nodes,
               int thriftPort,
               boolean dynamicNodeDiscovery)

Cluster

public Cluster(String nodes,
               IConnection.Config connectionConfig,
               boolean dynamicNodeDiscovery)

Cluster

public Cluster(String[] nodes,
               IConnection.Config connectionConfig,
               boolean dynamicNodeDiscovery)

Cluster

public Cluster(String[] nodes,
               IConnection.Config connectionConfig,
               boolean dynamicNodeDiscovery,
               Cluster.INodeFilter nodeFilter)

Cluster

public Cluster(String nodes,
               IConnection.Config connectionConfig,
               boolean dynamicNodeDiscovery,
               Cluster.INodeFilter nodeFilter)
Method Detail

getConnectionConfig

public IConnection.Config getConnectionConfig()
Configuration used to open new connections.

Returns:
the connection config

getNodes

public Cluster.Node[] getNodes()
The current list of available nodes.

Note: avoid calling this method is a tight loop.

Returns:
a copy of the current nodes

refresh

public void refresh(String keyspace)
Refresh the current list of nodes.

Parameters:
keyspace - optional keyspace name used to obtain the node ring

refresh

public void refresh()
Refresh the current list of nodes.



Copyright © 2011. All Rights Reserved.