com.basho.riak.client.raw.config
Class ClusterConfig<T extends Configuration>

java.lang.Object
  extended by com.basho.riak.client.raw.config.ClusterConfig<T>
Type Parameters:
T - concrete Configuration type
All Implemented Interfaces:
Configuration
Direct Known Subclasses:
HTTPClusterConfig, PBClusterConfig

public abstract class ClusterConfig<T extends Configuration>
extends Object
implements Configuration

Abstract parent Configuration for a "cluster" of clients.

Holds a collection of Configurations, one for each node in a cluster. Currently only supports homogeneous clusters.

Author:
russell

Field Summary
static int UNLIMITED_CONNECTIONS
          Constant for specifying unlimited maximum connection
 
Constructor Summary
ClusterConfig(int totalMaximumConnections)
           
 
Method Summary
 ClusterConfig<T> addClient(T clientConfig)
          Add a new client config to the collection of client in the cluster config
protected abstract  ClusterConfig<T> addHosts(String... hosts)
          Convenience method for creating a cluster of hosts with a common, default config except for host
protected abstract  ClusterConfig<T> addHosts(T config, String... hosts)
          Convenience method for creating a cluster of hosts with a common config except for host
 List<T> getClients()
           
 int getTotalMaximumConnections()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNLIMITED_CONNECTIONS

public static final int UNLIMITED_CONNECTIONS
Constant for specifying unlimited maximum connection

See Also:
Constant Field Values
Constructor Detail

ClusterConfig

public ClusterConfig(int totalMaximumConnections)
Parameters:
totalMaximumConnections - the upper limit of connections for all nodes in the config NOTE: set individual client limits in each client config
Method Detail

getTotalMaximumConnections

public int getTotalMaximumConnections()
Returns:
the totalMaximumConnections

addClient

public ClusterConfig<T> addClient(T clientConfig)
Add a new client config to the collection of client in the cluster config

Parameters:
nodeConfig - a node config to add
Returns:
this, updated
See Also:
HTTPClientConfig, PBClientConfig

getClients

public List<T> getClients()
Returns:
an *unmodifiable* view of the client Configurations in the cluster configuration

addHosts

protected abstract ClusterConfig<T> addHosts(String... hosts)
Convenience method for creating a cluster of hosts with a common, default config except for host

Parameters:
hosts - var arg String array of hosts
Returns:
the ClusterConfig with a node for each host in hosts

addHosts

protected abstract ClusterConfig<T> addHosts(T config,
                                             String... hosts)
Convenience method for creating a cluster of hosts with a common config except for host

Parameters:
config - T the common base config
hosts - var arg String array of hosts
Returns:
the ClusterConfig with a node for each host in hosts


Copyright © 2012. All Rights Reserved.