org.terracotta.modules.async
Interface AsyncConfig

All Known Implementing Classes:
DefaultAsyncConfig, WriteBehindAsyncConfig

public interface AsyncConfig

Allows the AsyncCoordinator to be configured with various parameters.


Method Summary
 int getBatchSize()
          The number of items to include in each batch when batching is enabled.
 long getMaxAllowedFallBehind()
          The maximum amount of time that a queue is allowed to fall behind on the work that it's processing.
 int getRateLimit()
          Sets the maximum number of operations to allow per second when isBatchingEnabled() is enabled.
 long getRetryAttemptDelay()
          Retrieves the number of milliseconds to wait before retrying a failed operation.
 int getRetryAttempts()
          Retrieves the number of times the processing of an item os retried.
 long getWorkDelay()
          Returns the amount of time to at least wait between individual work cycles.
 boolean isBatchingEnabled()
          Indicates whether to batch items.
 boolean isStealingEnabled()
          Indicates whether items can be stolen amongst queues or if each queue always has to process its own items
 boolean isSynchronousWrite()
          Perform all writes to the Terracotta backend in a synchronous fashion, hence increasing reliability but decreasing performance.
 

Method Detail

getWorkDelay

long getWorkDelay()
Returns the amount of time to at least wait between individual work cycles.

This allows work to accumulate in the write behind queue and be processed more efficiently.

Returns:
the work delay that should be used, in milliseconds

getMaxAllowedFallBehind

long getMaxAllowedFallBehind()
The maximum amount of time that a queue is allowed to fall behind on the work that it's processing.

This parameter is used to determine if the outstanding work of a queue can be stolen by another queue in the cluster.

Returns:
the maximum of time that the queue is allowed to fall behind, in milliseconds

isStealingEnabled

boolean isStealingEnabled()
Indicates whether items can be stolen amongst queues or if each queue always has to process its own items

Returns:
true when stealing is enabled; or false otherwise

getBatchSize

int getBatchSize()
The number of items to include in each batch when batching is enabled. If there are less entries in the queue than the batch size, the queue length size is used.

Returns:
the amount of items to batch

isBatchingEnabled

boolean isBatchingEnabled()
Indicates whether to batch items. If set to true, ItemProcessor.process(java.util.Collection) will be called rather than ItemProcessor.process(Object) being called for individual item. Resources such as databases can perform more efficiently if updates are batched, thus reducing load.

Returns:
true if items should be batched; false otherwise

isSynchronousWrite

boolean isSynchronousWrite()
Perform all writes to the Terracotta backend in a synchronous fashion, hence increasing reliability but decreasing performance.

Returns:
true to enable synchronous writes; or false to perform the write asynchronously

getRetryAttempts

int getRetryAttempts()
Retrieves the number of times the processing of an item os retried.

Returns:
the number of tries before this pass is considered failed

getRetryAttemptDelay

long getRetryAttemptDelay()
Retrieves the number of milliseconds to wait before retrying a failed operation.

Returns:
the delay in between retries, in milliseconds

getRateLimit

int getRateLimit()
Sets the maximum number of operations to allow per second when isBatchingEnabled() is enabled.

Returns:
the rate limit


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.