public class AsyncExecutor<T> extends Object implements Serializable
Service to asynchronously executes cassandra statements.
Modifier and Type | Field and Description |
---|---|
protected ExecutorService |
executorService |
protected AsyncResultHandler<T> |
handler |
protected com.datastax.driver.core.Session |
session |
Modifier | Constructor and Description |
---|---|
protected |
AsyncExecutor(com.datastax.driver.core.Session session,
AsyncResultHandler<T> handler)
Creates a new
AsyncExecutor instance. |
Modifier and Type | Method and Description |
---|---|
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() |
protected com.datastax.driver.core.Session session
protected ExecutorService executorService
protected AsyncResultHandler<T> handler
protected AsyncExecutor(com.datastax.driver.core.Session session, AsyncResultHandler<T> handler)
Creates a new AsyncExecutor
instance.
protected static ExecutorService newSingleThreadExecutor()
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.
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.
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.
public int getPendingTasksSize()
Returns the number of currently executed tasks which are not yet completed.
public void shutdown()
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.