org.apache.cassandra.service

## Class ReadCallback

- java.lang.Object
- - org.apache.cassandra.service.ReadCallback

All Implemented Interfaces:
  IAsyncCallback<ReadResponse>, IAsyncCallbackWithFailure<ReadResponse>

    public class ReadCallback
    extends java.lang.Object
    implements IAsyncCallbackWithFailure<ReadResponse>

### Field Summary

Fields
`protected static org.slf4j.Logger` `logger`
`ResponseResolver` `resolver`

### Fields inherited from interface org.apache.cassandra.net.IAsyncCallback

`isAlive`

### Constructor Summary

Constructors
Constructor and Description
`ReadCallback(ResponseResolver resolver, ConsistencyLevel consistencyLevel, int blockfor, ReadCommand command, Keyspace keyspace, java.util.List<java.net.InetAddress> endpoints, long queryStartNanoTime)`
`ReadCallback(ResponseResolver resolver, ConsistencyLevel consistencyLevel, ReadCommand command, java.util.List<java.net.InetAddress> filteredEndpoints, long queryStartNanoTime)` Constructor when response count has to be calculated and blocked for.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `assureSufficientLiveNodes()`
`boolean` `await(long timePastStart, java.util.concurrent.TimeUnit unit)`
`void` `awaitResults()`
`int` `blockFor()`
`PartitionIterator` `get()`
`int` `getReceivedCount()`
`boolean` `isLatencyForSnitch()`
`void` `onFailure(java.net.InetAddress from, RequestFailureReason failureReason)` Called when there is an exception on the remote node or timeout happens
`void` `response(MessageIn<ReadResponse> message)`
`void` `response(ReadResponse result)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.cassandra.net.IAsyncCallback

`supportsBackPressure`

### Field Detail

#### logger

    protected static final org.slf4j.Logger logger

#### resolver

    public final ResponseResolver resolver

### Constructor Detail

#### ReadCallback

    public ReadCallback(ResponseResolver resolver,
                        ConsistencyLevel consistencyLevel,
                        ReadCommand command,
                        java.util.List<java.net.InetAddress> filteredEndpoints,
                        long queryStartNanoTime)

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

#### ReadCallback

    public ReadCallback(ResponseResolver resolver,
                        ConsistencyLevel consistencyLevel,
                        int blockfor,
                        ReadCommand command,
                        Keyspace keyspace,
                        java.util.List<java.net.InetAddress> endpoints,
                        long queryStartNanoTime)

### Method Detail

#### await

    public boolean await(long timePastStart,
                         java.util.concurrent.TimeUnit unit)

#### awaitResults

    public void awaitResults()
                      throws ReadFailureException,
                             ReadTimeoutException

Throws:
  `ReadFailureException`
  `ReadTimeoutException`

#### get

    public PartitionIterator get()
                          throws ReadFailureException,
                                 ReadTimeoutException,
                                 DigestMismatchException

Throws:
  `ReadFailureException`
  `ReadTimeoutException`
  `DigestMismatchException`

#### blockFor

    public int blockFor()

#### response

    public void response(MessageIn<ReadResponse> message)

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

#### getReceivedCount

    public int getReceivedCount()

Returns:
  the current number of received responses

#### response

    public void response(ReadResponse result)

#### assureSufficientLiveNodes

    public void assureSufficientLiveNodes()
                                   throws UnavailableException

Throws:
  `UnavailableException`

#### isLatencyForSnitch

    public boolean isLatencyForSnitch()

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

#### onFailure

    public void onFailure(java.net.InetAddress from,
                          RequestFailureReason failureReason)

Description copied from interface: `IAsyncCallbackWithFailure`
Called when there is an exception on the remote node or timeout happens

Specified by:
  `onFailure` in interface `IAsyncCallbackWithFailure<ReadResponse>`