org.apache.storm.cassandra.executor

## Class AsyncExecutor<T>

- java.lang.Object
- - org.apache.storm.cassandra.executor.AsyncExecutor<T>

- All Implemented Interfaces:
    Serializable

      public class AsyncExecutor<T>
      extends Object
      implements Serializable

  Service to asynchronously executes cassandra statements.

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AsyncExecutor.MultiFailedException`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ExecutorService` | `executorService`
    `protected AsyncResultHandler<T>` | `handler`
    `protected com.datastax.driver.core.Session` | `session`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AsyncExecutor(com.datastax.driver.core.Session session, AsyncResultHandler<T> handler)` Creates a new `AsyncExecutor` instance.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.google.common.util.concurrent.SettableFuture<List<T>>` | `execAsync(List<com.datastax.driver.core.Statement> statements, List<T> inputs, Semaphore throttle, AsyncResultSetHandler<T> handler)` Asynchronously executes the specified select statements.
    `List<com.google.common.util.concurrent.SettableFuture<T>>` | `execAsync(List<com.datastax.driver.core.Statement> statements, T input)` Asynchronously executes all statements associated to the specified input.
    `com.google.common.util.concurrent.SettableFuture<T>` | `execAsync(com.datastax.driver.core.Statement statement, T inputs)` Asynchronously executes the specified batch statement.
    `com.google.common.util.concurrent.SettableFuture<T>` | `execAsync(com.datastax.driver.core.Statement statement, T inputs, AsyncResultHandler<T> handler)` Asynchronously executes the specified batch statement.
    `int` | `getPendingTasksSize()` Returns the number of currently executed tasks which are not yet completed.
    `protected static ExecutorService` | `newSingleThreadExecutor()`
    `void` | `shutdown()`

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

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

- - ### Field Detail

    - #### session

          protected com.datastax.driver.core.Session session

    - #### executorService

          protected ExecutorService executorService

    - #### handler

          protected AsyncResultHandler<T> handler

  - ### Constructor Detail

    - #### AsyncExecutor

          protected AsyncExecutor(com.datastax.driver.core.Session session,
                                  AsyncResultHandler<T> handler)

      Creates a new `AsyncExecutor` instance.

  - ### Method Detail

    - #### newSingleThreadExecutor

          protected static ExecutorService newSingleThreadExecutor()

    - #### execAsync

          public List<com.google.common.util.concurrent.SettableFuture<T>> execAsync(List<com.datastax.driver.core.Statement> statements,
                                                                                     T input)

      Asynchronously executes all statements associated to the specified input. The input will be passed to handler#onSuccess once all queries succeed or to handler#onFailure if any one of them fails.

    - #### execAsync

          public com.google.common.util.concurrent.SettableFuture<T> execAsync(com.datastax.driver.core.Statement statement,
                                                                               T inputs)

      Asynchronously executes the specified batch statement. Inputs will be passed to the `handler` once query succeed or failed.

    - #### execAsync

          public com.google.common.util.concurrent.SettableFuture<T> execAsync(com.datastax.driver.core.Statement statement,
                                                                               T inputs,
                                                                               AsyncResultHandler<T> handler)

      Asynchronously executes the specified batch statement. Inputs will be passed to the `handler` once query succeed or failed.

    - #### execAsync

          public com.google.common.util.concurrent.SettableFuture<List<T>> execAsync(List<com.datastax.driver.core.Statement> statements,
                                                                                     List<T> inputs,
                                                                                     Semaphore throttle,
                                                                                     AsyncResultSetHandler<T> handler)

      Asynchronously executes the specified select statements. Results will be passed to the `AsyncResultSetHandler` once each query has succeed or failed.

    - #### getPendingTasksSize

          public int getPendingTasksSize()

      Returns the number of currently executed tasks which are not yet completed.

    - #### shutdown

          public void shutdown()

Copyright © 2021 The Apache Software Foundation. All rights reserved.