public class RiakCluster extends Object implements OperationRetrier, NodeStateListener
This class represents a Riak Cluster upon which operations are executed.
Instances are created using the RiakCluster.Builder
Modifier and Type | Class and Description |
---|---|
static class |
RiakCluster.Builder
Builder used to create
RiakCluster instances. |
Modifier and Type | Method and Description |
---|---|
void |
addNode(RiakNode node)
Adds a
RiakNode to this cluster. |
static RiakCluster.Builder |
builder(List<RiakNode> nodes) |
static RiakCluster.Builder |
builder(RiakNode node) |
<V,S> RiakFuture<V,S> |
execute(FutureOperation<V,?,S> operation) |
List<RiakNode> |
getNodes()
Returns a copy of the list of nodes in this cluster.
|
void |
nodeStateChanged(RiakNode node,
RiakNode.State state) |
void |
operationComplete(FutureOperation operation,
int remainingRetries) |
void |
operationFailed(FutureOperation operation,
int remainingRetries) |
boolean |
removeNode(RiakNode node)
Removes the provided node from the cluster.
|
Future<Boolean> |
shutdown() |
void |
start() |
public void start()
public <V,S> RiakFuture<V,S> execute(FutureOperation<V,?,S> operation)
public void addNode(RiakNode node) throws UnknownHostException
RiakNode
to this cluster.
The node can not have been started nor have its Bootstrap or Executor
asSet.node
- the RiakNode to addUnknownHostException
- if the RiakNode's hostname cannot be resolvedIllegalArgumentException
- if the node's Bootstrap or Executor are already asSet.public boolean removeNode(RiakNode node)
node
- public List<RiakNode> getNodes()
public void nodeStateChanged(RiakNode node, RiakNode.State state)
nodeStateChanged
in interface NodeStateListener
public void operationFailed(FutureOperation operation, int remainingRetries)
operationFailed
in interface OperationRetrier
public void operationComplete(FutureOperation operation, int remainingRetries)
operationComplete
in interface OperationRetrier
public static RiakCluster.Builder builder(List<RiakNode> nodes)
public static RiakCluster.Builder builder(RiakNode node)
Copyright © 2014. All rights reserved.