ReadCallback (apache-cassandra API)
Date: 2018-02-12

org.apache.cassandra.service

## Class ReadCallback<TMessage,TResolved>

- java.lang.Object
- - org.apache.cassandra.service.ReadCallback<TMessage,TResolved>

- All Implemented Interfaces:
    IAsyncCallback<TMessage>, IAsyncCallbackWithFailure<TMessage>

      public class ReadCallback<TMessage,TResolved>
      extends java.lang.Object
      implements IAsyncCallbackWithFailure<TMessage>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.slf4j.Logger` | `logger`
    `IResponseResolver<TMessage,TResolved>` | `resolver`

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

      `isAlive`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `assureSufficientLiveNodes()`
    `boolean` | `await(long timePastStart, java.util.concurrent.TimeUnit unit)`
    `TResolved` | `get()`
    `int` | `getReceivedCount()`
    `boolean` | `isLatencyForSnitch()`
    `void` | `onFailure(java.net.InetAddress from)` Called when there is an exception on the remote node or timeout happens
    `void` | `response(MessageIn<TMessage> message)`
    `void` | `response(TMessage result)`

    - ### 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

    - #### resolver

          public final IResponseResolver<TMessage,TResolved> resolver

  - ### Constructor Detail

    - #### ReadCallback

          public ReadCallback(IResponseResolver<TMessage,TResolved> resolver,
                              ConsistencyLevel consistencyLevel,
                              IReadCommand command,
                              java.util.List<java.net.InetAddress> filteredEndpoints)

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

    - #### ReadCallback

          public ReadCallback(IResponseResolver<TMessage,TResolved> resolver,
                              ConsistencyLevel consistencyLevel,
                              int blockfor,
                              IReadCommand command,
                              Keyspace keyspace,
                              java.util.List<java.net.InetAddress> endpoints)

  - ### Method Detail

    - #### await

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

    - #### get

          public TResolved get()
                        throws ReadFailureException,
                               ReadTimeoutException,
                               DigestMismatchException

      Throws:
        `ReadFailureException`
        `ReadTimeoutException`
        `DigestMismatchException`

    - #### response

          public void response(MessageIn<TMessage> message)

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

    - #### getReceivedCount

          public int getReceivedCount()

      Returns:
        the current number of received responses

    - #### response

          public void response(TMessage result)

    - #### assureSufficientLiveNodes

          public void assureSufficientLiveNodes()
                                         throws UnavailableException

      Throws:
        `UnavailableException`

    - #### isLatencyForSnitch

          public boolean isLatencyForSnitch()

      Specified by:
        `isLatencyForSnitch` in interface `IAsyncCallback<TMessage>`
      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)

      Description copied from interface: `IAsyncCallbackWithFailure`
      Called when there is an exception on the remote node or timeout happens
      Specified by:
        `onFailure` in interface `IAsyncCallbackWithFailure<TMessage>`

Copyright © 2018 The Apache Software Foundation