org.apache.cassandra.service

## Class WriteResponseHandler<T>

- java.lang.Object
- - org.apache.cassandra.service.AbstractWriteResponseHandler<T>
  - - org.apache.cassandra.service.WriteResponseHandler<T>

- All Implemented Interfaces:
    IAsyncCallback<T>, IAsyncCallbackWithFailure<T>
  Direct Known Subclasses:
    DatacenterWriteResponseHandler

      public class WriteResponseHandler<T>
      extends AbstractWriteResponseHandler<T>

  Handles blocking writes for ONE, ANY, TWO, THREE, QUORUM, and ALL consistency levels.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.slf4j.Logger` | `logger`
    `protected int` | `responses`

    - ### Fields inherited from class org.apache.cassandra.service.AbstractWriteResponseHandler

      `callback, consistencyLevel, keyspace, naturalEndpoints, pendingEndpoints, writeType`

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

      `isAlive`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WriteResponseHandler(java.util.Collection<java.net.InetAddress> writeEndpoints, java.util.Collection<java.net.InetAddress> pendingEndpoints, ConsistencyLevel consistencyLevel, Keyspace keyspace, java.lang.Runnable callback, WriteType writeType, long queryStartNanoTime)`
    `WriteResponseHandler(java.net.InetAddress endpoint, WriteType writeType, long queryStartNanoTime)`
    `WriteResponseHandler(java.net.InetAddress endpoint, WriteType writeType, java.lang.Runnable callback, long queryStartNanoTime)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `ackCount()`
    `boolean` | `isLatencyForSnitch()`
    `void` | `response(MessageIn<T> m)` null message means "response from local write"

    - ### Methods inherited from class org.apache.cassandra.service.AbstractWriteResponseHandler

      `assureSufficientLiveNodes, currentTimeout, get, onFailure, setSupportsBackPressure, signal, supportsBackPressure, totalBlockFor, totalEndpoints, waitingFor`

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

    - #### responses

          protected volatile int responses

  - ### Constructor Detail

    - #### WriteResponseHandler

          public WriteResponseHandler(java.util.Collection<java.net.InetAddress> writeEndpoints,
                                      java.util.Collection<java.net.InetAddress> pendingEndpoints,
                                      ConsistencyLevel consistencyLevel,
                                      Keyspace keyspace,
                                      java.lang.Runnable callback,
                                      WriteType writeType,
                                      long queryStartNanoTime)

    - #### WriteResponseHandler

          public WriteResponseHandler(java.net.InetAddress endpoint,
                                      WriteType writeType,
                                      java.lang.Runnable callback,
                                      long queryStartNanoTime)

    - #### WriteResponseHandler

          public WriteResponseHandler(java.net.InetAddress endpoint,
                                      WriteType writeType,
                                      long queryStartNanoTime)

  - ### Method Detail

    - #### response

          public void response(MessageIn<T> m)

      Description copied from class: `AbstractWriteResponseHandler`
      null message means "response from local write"
      Specified by:
        `response` in interface `IAsyncCallback<T>`
      Specified by:
        `response` in class `AbstractWriteResponseHandler<T>`
      Parameters:
        `m` - response received.

    - #### ackCount

          protected int ackCount()

      Specified by:
        `ackCount` in class `AbstractWriteResponseHandler<T>`
      Returns:
        number of responses received

    - #### isLatencyForSnitch

          public boolean isLatencyForSnitch()

      Returns:
        true if this callback is on the read path and its latency should be given as input to the dynamic snitch.

Copyright © 2018 The Apache Software Foundation