org.apache.cassandra.service
Class DatacenterReadCallback<TMessage,TResolved>

java.lang.Object
  extended by org.apache.cassandra.service.ReadCallback<TMessage,TResolved>
      extended by org.apache.cassandra.service.DatacenterReadCallback<TMessage,TResolved>
All Implemented Interfaces:
IAsyncCallback<TMessage>, IMessageCallback

public class DatacenterReadCallback<TMessage,TResolved>
extends ReadCallback<TMessage,TResolved>

Datacenter Quorum response handler blocks for a quorum of responses from the local DC


Field Summary
 
Fields inherited from class org.apache.cassandra.service.ReadCallback
blockfor, condition, consistencyLevel, localdc, logger, received, resolver, snitch
 
Constructor Summary
DatacenterReadCallback(IResponseResolver resolver, ConsistencyLevel consistencyLevel, IReadCommand command, java.util.List<java.net.InetAddress> endpoints)
           
 
Method Summary
 void assureSufficientLiveNodes()
           
protected  void sortForConsistencyLevel(java.util.List<java.net.InetAddress> endpoints)
          Endpoints is already restricted to live replicas, sorted by snitch preference.
protected  boolean waitingFor(MessageIn message)
           
 
Methods inherited from class org.apache.cassandra.service.ReadCallback
get, isLatencyForSnitch, maybeResolveForRepair, response, response
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatacenterReadCallback

public DatacenterReadCallback(IResponseResolver resolver,
                              ConsistencyLevel consistencyLevel,
                              IReadCommand command,
                              java.util.List<java.net.InetAddress> endpoints)
Method Detail

sortForConsistencyLevel

protected void sortForConsistencyLevel(java.util.List<java.net.InetAddress> endpoints)
Description copied from class: ReadCallback
Endpoints is already restricted to live replicas, sorted by snitch preference. This is a hook for DatacenterReadCallback to move local-DC replicas to the front of the list. We need this both when doing read repair (because the first replica gets the data read) and otherwise (because only the first 1..blockfor replicas will get digest reads).

Overrides:
sortForConsistencyLevel in class ReadCallback<TMessage,TResolved>

waitingFor

protected boolean waitingFor(MessageIn message)
Overrides:
waitingFor in class ReadCallback<TMessage,TResolved>
Returns:
true if the message counts towards the blockfor threshold

assureSufficientLiveNodes

public void assureSufficientLiveNodes()
                               throws UnavailableException
Overrides:
assureSufficientLiveNodes in class ReadCallback<TMessage,TResolved>
Throws:
UnavailableException


Copyright © 2012 The Apache Software Foundation