public abstract class AbstractBulkExecutorBuilder<T extends BulkExecutor> extends Object implements BulkExecutorBuilder<T>
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
failFast |
protected ExecutionListener |
listener |
protected int |
maxInFlightRequests |
protected int |
maxRequestsPerSecond |
protected CqlSession |
session |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBulkExecutorBuilder(CqlSession session) |
| Modifier and Type | Method and Description |
|---|---|
AbstractBulkExecutorBuilder<T> |
failSafe()
Switches on fail-safe mode.
|
AbstractBulkExecutorBuilder<T> |
withExecutionListener(ExecutionListener listener)
Sets an optional
ExecutionListener. |
AbstractBulkExecutorBuilder<T> |
withMaxInFlightRequests(int maxInFlightRequests)
Sets the maximum number of in-flight requests.
|
AbstractBulkExecutorBuilder<T> |
withMaxRequestsPerSecond(int maxRequestsPerSecond)
Sets the maximum number of concurrent requests per second.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuildprotected final CqlSession session
protected boolean failFast
protected int maxInFlightRequests
protected int maxRequestsPerSecond
protected ExecutionListener listener
protected AbstractBulkExecutorBuilder(CqlSession session)
public AbstractBulkExecutorBuilder<T> failSafe()
BulkExecutorBuilderBy default, executors are created in fail-fast mode, i.e. any execution error stops the
whole operation. In fail-fast mode, the error is wrapped within a BulkExecutionException that conveys the failed Statement. With synchronous operations,
the exception is thrown directly; with asynchronous ones, the returned future is completed
exceptionally. Important: in fail-fast mode, if a statement execution fails, all pending
requests are abandoned; there is no guarantee that all previously submitted statements will
complete before the executor stops.
In fail-safe mode, the error is converted into a WriteResult or ReadResult
and passed on to consumers, along with the failed Statement; then the execution resumes
at the next statement. The Result interface exposes two useful methods when operating
in fail-safe mode:
Result.isSuccess() tells if the statement was executed successfully.
Result.getError() can be used to retrieve the error.
failSafe in interface BulkExecutorBuilder<T extends BulkExecutor>public AbstractBulkExecutorBuilder<T> withMaxInFlightRequests(int maxInFlightRequests)
BulkExecutorBuilderThis acts as a safeguard against workflows that generate more requests than they can handle.
The default is AbstractBulkExecutor.DEFAULT_MAX_IN_FLIGHT_REQUESTS. Setting this option
to any negative value will disable it.
withMaxInFlightRequests in interface BulkExecutorBuilder<T extends BulkExecutor>maxInFlightRequests - the maximum number of in-flight requests.public AbstractBulkExecutorBuilder<T> withMaxRequestsPerSecond(int maxRequestsPerSecond)
BulkExecutorBuilderThis acts as a safeguard against workflows that could overwhelm the cluster with more
requests than it can handle. The default is AbstractBulkExecutor.DEFAULT_MAX_REQUESTS_PER_SECOND. Setting this option to any negative
value will disable it.
withMaxRequestsPerSecond in interface BulkExecutorBuilder<T extends BulkExecutor>maxRequestsPerSecond - the maximum number of concurrent requests per second.public AbstractBulkExecutorBuilder<T> withExecutionListener(ExecutionListener listener)
BulkExecutorBuilderExecutionListener.withExecutionListener in interface BulkExecutorBuilder<T extends BulkExecutor>listener - the ExecutionListener to use.Copyright © 2017–2021 DataStax. All rights reserved.