BatchPolicy.Builder

public static final class BatchPolicy.Builder extends Object

Builder object for creating an instance of BatchRequest.

Public Constructor Summary

Public Method Summary

BatchPolicy
build()
Builds an instance of BatchPolicy.
BatchPolicy.Builder
setBatchConnectTimeoutSeconds(int batchConnectTimeout)
Sets connect timeout in seconds for entire BatchRequest
BatchPolicy.Builder
setBatchReadTimeoutSeconds(int batchReadTimeout)
Sets read timeout in seconds for entire BatchRequest
BatchPolicy.Builder
setFlushOnShutdown(boolean flushOnShutdown)
Sets flag to indicate if BatchRequestService should execute already enqueued requests once BatchRequestService shutdown is initiated or mark such requests as cancelled.
BatchPolicy.Builder
setMaxActiveBatches(int maxActiveBatches)
Sets maximum concurrent batch requests allowed to be executed.
BatchPolicy.Builder
setMaxBatchDelay(int maxBatchDelay, TimeUnit maxBatchDelayUnit)
Sets auto flush delay for batched request.
BatchPolicy.Builder
setMaxBatchSize(int maxBatchSize)
Sets maximum number of requests to be batched together.
BatchPolicy.Builder
setQueueLength(int queueLength)
Sets total length of active batch request queue.

Inherited Method Summary

Public Constructors

public BatchPolicy.Builder ()

Public Methods

public BatchPolicy build ()

Builds an instance of BatchPolicy.

Returns

public BatchPolicy.Builder setBatchConnectTimeoutSeconds (int batchConnectTimeout)

Sets connect timeout in seconds for entire BatchRequest

Parameters
batchConnectTimeout connect timeout for entire BatchRequest
Returns
  • this Builder instance

public BatchPolicy.Builder setBatchReadTimeoutSeconds (int batchReadTimeout)

Sets read timeout in seconds for entire BatchRequest

Parameters
batchReadTimeout read timeout for entire BatchRequest
Returns
  • this Builder instance

public BatchPolicy.Builder setFlushOnShutdown (boolean flushOnShutdown)

Sets flag to indicate if BatchRequestService should execute already enqueued requests once BatchRequestService shutdown is initiated or mark such requests as cancelled.

Parameters
flushOnShutdown Set to true if already enqueued requests should be executed once shutdown is initiated. Set to false to mark already enqueued requests as cancelled once shutdown is initiated.
Returns
  • this Builder instance

public BatchPolicy.Builder setMaxActiveBatches (int maxActiveBatches)

Sets maximum concurrent batch requests allowed to be executed.

Parameters
maxActiveBatches maximum concurrent batch requests allowed to be executed simultaneously.
Returns
  • this Builder instance

public BatchPolicy.Builder setMaxBatchDelay (int maxBatchDelay, TimeUnit maxBatchDelayUnit)

Sets auto flush delay for batched request.

Parameters
maxBatchDelay auto flush delay.
maxBatchDelayUnit TimeUnit for auto flush delay.
Returns
  • this Builder instance

public BatchPolicy.Builder setMaxBatchSize (int maxBatchSize)

Sets maximum number of requests to be batched together.

Parameters
maxBatchSize maximum number of requests to be batched together
Returns
  • this Builder instance

public BatchPolicy.Builder setQueueLength (int queueLength)

Sets total length of active batch request queue.

Parameters
queueLength total length of active batch request queue.
Returns
  • this Builder instance