Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cassandra.service
Class ReadCallback<T>

    java.lang.Object
      org.apache.cassandra.service.ReadCallback<T>

All Implemented Interfaces:
  IAsyncCallback, IMessageCallback

Direct Known Subclasses:
  DatacenterReadCallback

    public class ReadCallback<T>

extends java.lang.Object
implements IAsyncCallback

Field Summary
`protected int` | `blockfor`
`protected SimpleCondition` | `condition`
`protected static java.lang.String` | `localdc`
`protected static org.slf4j.Logger` | `logger`
`protected java.util.concurrent.atomic.AtomicInteger` | `received`
`IResponseResolver<T>` | `resolver`
`protected static IEndpointSnitch` | `snitch`

Constructor Summary
`ReadCallback(IResponseResolver<T> resolver, ConsistencyLevel consistencyLevel, IReadCommand command, java.util.List<java.net.InetAddress> endpoints)` Constructor when response count has to be calculated and blocked for.

Method Summary
`void` | `assureSufficientLiveNodes()`
`int` | `determineBlockFor(ConsistencyLevel consistencyLevel, java.lang.String table)`
`T` | `get()`
`boolean` | `isLatencyForSnitch()`
`protected void` | `maybeResolveForRepair()` Check digests in the background on the Repair stage if we've received replies too all the requests we sent.
`void` | `response(Message message)`
`void` | `response(ReadResponse result)`
`protected void` | `sortForConsistencyLevel(java.util.List<java.net.InetAddress> endpoints)` Endpoints is already restricted to live replicas, sorted by snitch preference.
`protected boolean` | `waitingFor(Message message)`
`protected boolean` | `waitingFor(ReadResponse response)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### logger

    protected static final org.slf4j.Logger logger

### snitch

    protected static final IEndpointSnitch snitch

### localdc

    protected static final java.lang.String localdc

### resolver

    public final IResponseResolver<T> resolver

### condition

    protected final SimpleCondition condition

### blockfor

    protected final int blockfor

### received

    protected final java.util.concurrent.atomic.AtomicInteger received

Constructor Detail

### ReadCallback

    public ReadCallback(IResponseResolver<T> resolver,
                        ConsistencyLevel consistencyLevel,
                        IReadCommand command,
                        java.util.List<java.net.InetAddress> endpoints)

  Constructor when response count has to be calculated and blocked for.

Method Detail

### sortForConsistencyLevel

    protected void sortForConsistencyLevel(java.util.List<java.net.InetAddress> endpoints)

  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).

### get

    public T get()
          throws java.util.concurrent.TimeoutException,
                 DigestMismatchException,
                 java.io.IOException

  Throws:
    `java.util.concurrent.TimeoutException`
    `DigestMismatchException`
    `java.io.IOException`

### response

    public void response(Message message)

  Specified by:
    `response` in interface `IAsyncCallback`
  Parameters:
    `message` - response received.

### waitingFor

    protected boolean waitingFor(Message message)

  Returns:
    true if the message counts towards the blockfor threshold TODO turn the Message into a response so we don't need two versions of this method

### waitingFor

    protected boolean waitingFor(ReadResponse response)

  Returns:
    true if the response counts towards the blockfor threshold

### response

    public void response(ReadResponse result)

### maybeResolveForRepair

    protected void maybeResolveForRepair()

  Check digests in the background on the Repair stage if we've received replies too all the requests we sent.

### determineBlockFor

    public int determineBlockFor(ConsistencyLevel consistencyLevel,
                                 java.lang.String table)

### assureSufficientLiveNodes

    public void assureSufficientLiveNodes()
                                   throws UnavailableException

  Throws:
    `UnavailableException`

### isLatencyForSnitch

    public boolean isLatencyForSnitch()

  Specified by:
    `isLatencyForSnitch` in interface `IMessageCallback`
  Returns:
    true if this callback is on the read path and its latency should be given as input to the dynamic snitch.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 The Apache Software Foundation