AbstractWriteResponseHandler (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.service

## Class AbstractWriteResponseHandler<T>

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

- All Implemented Interfaces:
    IAsyncCallback<T>, IAsyncCallbackWithFailure<T>
  Direct Known Subclasses:
    BatchlogResponseHandler, DatacenterSyncWriteResponseHandler, WriteResponseHandler

      public abstract class AbstractWriteResponseHandler<T>
      extends java.lang.Object
      implements IAsyncCallbackWithFailure<T>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Runnable` | `callback`
    `ConsistencyLevel` | `consistencyLevel`
    `protected Keyspace` | `keyspace`
    `protected static org.slf4j.Logger` | `logger`
    `protected java.util.Collection<java.net.InetAddress>` | `naturalEndpoints`
    `protected java.util.Collection<java.net.InetAddress>` | `pendingEndpoints`
    `protected WriteType` | `writeType`

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

      `isAlive`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractWriteResponseHandler(Keyspace keyspace, java.util.Collection<java.net.InetAddress> naturalEndpoints, java.util.Collection<java.net.InetAddress> pendingEndpoints, ConsistencyLevel consistencyLevel, java.lang.Runnable callback, WriteType writeType, long queryStartNanoTime)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract int` | `ackCount()`
    `void` | `assureSufficientLiveNodes()`
    `long` | `currentTimeout()`
    `void` | `get()`
    `void` | `onFailure(java.net.InetAddress from, RequestFailureReason failureReason)` Called when there is an exception on the remote node or timeout happens
    `abstract void` | `response(MessageIn<T> msg)` null message means "response from local write"
    `void` | `setSupportsBackPressure(boolean supportsBackPressure)`
    `protected void` | `signal()`
    `boolean` | `supportsBackPressure()`
    `protected int` | `totalBlockFor()`
    `protected int` | `totalEndpoints()`
    `protected boolean` | `waitingFor(java.net.InetAddress from)`

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

      `isLatencyForSnitch`

- - ### Field Detail

    - #### logger

          protected static final org.slf4j.Logger logger

    - #### keyspace

          protected final Keyspace keyspace

    - #### naturalEndpoints

          protected final java.util.Collection<java.net.InetAddress> naturalEndpoints

    - #### consistencyLevel

          public final ConsistencyLevel consistencyLevel

    - #### callback

          protected final java.lang.Runnable callback

    - #### pendingEndpoints

          protected final java.util.Collection<java.net.InetAddress> pendingEndpoints

    - #### writeType

          protected final WriteType writeType

  - ### Constructor Detail

    - #### AbstractWriteResponseHandler

          protected AbstractWriteResponseHandler(Keyspace keyspace,
                                                 java.util.Collection<java.net.InetAddress> naturalEndpoints,
                                                 java.util.Collection<java.net.InetAddress> pendingEndpoints,
                                                 ConsistencyLevel consistencyLevel,
                                                 java.lang.Runnable callback,
                                                 WriteType writeType,
                                                 long queryStartNanoTime)

      Parameters:
        `callback` - A callback to be called when the write is successful.
        `queryStartNanoTime` -

  - ### Method Detail

    - #### get

          public void get()
                   throws WriteTimeoutException,
                          WriteFailureException

      Throws:
        `WriteTimeoutException`
        `WriteFailureException`

    - #### currentTimeout

          public final long currentTimeout()

    - #### totalBlockFor

          protected int totalBlockFor()

      Returns:
        the minimum number of endpoints that must reply.

    - #### totalEndpoints

          protected int totalEndpoints()

      Returns:
        the total number of endpoints the request has been sent to.

    - #### waitingFor

          protected boolean waitingFor(java.net.InetAddress from)

      Returns:
        true if the message counts towards the totalBlockFor() threshold

    - #### ackCount

          protected abstract int ackCount()

      Returns:
        number of responses received

    - #### response

          public abstract void response(MessageIn<T> msg)

      null message means "response from local write"
      Specified by:
        `response` in interface `IAsyncCallback<T>`
      Parameters:
        `msg` - response received.

    - #### assureSufficientLiveNodes

          public void assureSufficientLiveNodes()
                                         throws UnavailableException

      Throws:
        `UnavailableException`

    - #### signal

          protected void signal()

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

    - #### supportsBackPressure

          public boolean supportsBackPressure()

      Specified by:
        `supportsBackPressure` in interface `IAsyncCallback<T>`

    - #### setSupportsBackPressure

          public void setSupportsBackPressure(boolean supportsBackPressure)

Copyright © 2018 The Apache Software Foundation