me.prettyprint.cassandra.service
Class Operation<T>

java.lang.Object
  extended by me.prettyprint.cassandra.service.Operation<T>
Type Parameters:
T - The result type of the operation (if it has a result), such as the result of get_count or get_column Oh closures, how I wish you were here...
Direct Known Subclasses:
VirtualKeyspaceOperation

public abstract class Operation<T>
extends Object

Defines an operation performed on cassandra


Field Summary
 ConsistencyLevelPolicy consistencyLevelPolicy
           
 Map<String,String> credentials
           
protected  long execTime
           
 CassandraClientMonitor.Counter failCounter
          Counts failed attempts
 FailoverPolicy failoverPolicy
           
 String keyspaceName
           
 OperationType operationType
           
protected  T result
           
 String stopWatchTagName
          The stopwatch used to measure operation performance
 
Constructor Summary
Operation(OperationType operationType)
           
Operation(OperationType operationType, FailoverPolicy failoverPolicy, String keyspaceName, Map<String,String> credentials)
           
Operation(OperationType operationType, Map<String,String> credentials)
           
 
Method Summary
 void applyConnectionParams(String keyspace, ConsistencyLevelPolicy consistencyLevelPolicy, FailoverPolicy failoverPolicy, Map<String,String> credentials)
           
abstract  T execute(org.apache.cassandra.thrift.Cassandra.Client cassandra)
          Performs the operation on the given cassandra instance.
 void executeAndSetResult(org.apache.cassandra.thrift.Cassandra.Client cassandra, CassandraHost cassandraHost)
           
 CassandraHost getCassandraHost()
           
 HectorException getException()
           
 ExecutionResult<T> getExecutionResult()
           
 T getResult()
           
 boolean hasException()
           
 void setException(HectorException e)
           
 void setResult(T executionResult)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

failCounter

public final CassandraClientMonitor.Counter failCounter
Counts failed attempts


stopWatchTagName

public final String stopWatchTagName
The stopwatch used to measure operation performance


failoverPolicy

public FailoverPolicy failoverPolicy

consistencyLevelPolicy

public ConsistencyLevelPolicy consistencyLevelPolicy

keyspaceName

public String keyspaceName

credentials

public Map<String,String> credentials

result

protected T result

execTime

protected long execTime

operationType

public final OperationType operationType
Constructor Detail

Operation

public Operation(OperationType operationType)

Operation

public Operation(OperationType operationType,
                 Map<String,String> credentials)

Operation

public Operation(OperationType operationType,
                 FailoverPolicy failoverPolicy,
                 String keyspaceName,
                 Map<String,String> credentials)
Method Detail

applyConnectionParams

public void applyConnectionParams(String keyspace,
                                  ConsistencyLevelPolicy consistencyLevelPolicy,
                                  FailoverPolicy failoverPolicy,
                                  Map<String,String> credentials)

setResult

public void setResult(T executionResult)

getResult

public T getResult()
Returns:
The result of the operation, if this is an operation that has a result (such as getColumn etc.

getExecutionResult

public ExecutionResult<T> getExecutionResult()

execute

public abstract T execute(org.apache.cassandra.thrift.Cassandra.Client cassandra)
                   throws HectorException
Performs the operation on the given cassandra instance.

Throws:
HectorException

executeAndSetResult

public void executeAndSetResult(org.apache.cassandra.thrift.Cassandra.Client cassandra,
                                CassandraHost cassandraHost)
                         throws HectorException
Throws:
HectorException

setException

public void setException(HectorException e)

hasException

public boolean hasException()

getException

public HectorException getException()

getCassandraHost

public CassandraHost getCassandraHost()


Copyright © 2011. All Rights Reserved.