public interface BulkExecutorBuilder<T extends BulkExecutor>
BulkExecutor instances.| Modifier and Type | Method and Description |
|---|---|
T |
build()
Builds a new instance.
|
BulkExecutorBuilder<T> |
failSafe()
Switches on fail-safe mode.
|
BulkExecutorBuilder<T> |
withExecutionListener(ExecutionListener listener)
Sets an optional
ExecutionListener. |
BulkExecutorBuilder<T> |
withMaxInFlightRequests(int maxInFlightRequests)
Sets the maximum number of in-flight requests.
|
BulkExecutorBuilder<T> |
withMaxRequestsPerSecond(int maxRequestsPerSecond)
Sets the maximum number of concurrent requests per second.
|
BulkExecutorBuilder<T> failSafe()
By 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.
BulkExecutorBuilder<T> withMaxInFlightRequests(int maxInFlightRequests)
This 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.
maxInFlightRequests - the maximum number of in-flight requests.BulkExecutorBuilder<T> withMaxRequestsPerSecond(int maxRequestsPerSecond)
This 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.
maxRequestsPerSecond - the maximum number of concurrent requests per second.BulkExecutorBuilder<T> withExecutionListener(ExecutionListener listener)
ExecutionListener.listener - the ExecutionListener to use.T build()
Copyright © 2017–2021 DataStax. All rights reserved.