org.terracotta.modules.ehcache.async
Class DefaultAsyncConfig

java.lang.Object
  extended by org.terracotta.modules.ehcache.async.DefaultAsyncConfig
All Implemented Interfaces:
Serializable, AsyncConfig

public class DefaultAsyncConfig
extends Object
implements AsyncConfig

See Also:
Serialized Form

Field Summary
static int BATCH_SIZE
           
static boolean BATCHING_ENABLED
           
static long MAX_ALLOWED_FALLBEHIND
           
static int MAX_QUEUE_SIZE
           
static int RATE_LIMIT
           
static long RETRY_ATTEMPT_DELAY
           
static int RETRY_ATTEMPTS
           
static boolean SYNCHRONOUS_WRITE
           
static long WORK_DELAY
           
 
Constructor Summary
protected DefaultAsyncConfig()
           
 
Method Summary
 int getBatchSize()
          The number of items to include in each batch when batching is enabled.
static AsyncConfig getInstance()
          Return an AsyncConfig instance representing the default configuration.
 long getMaxAllowedFallBehind()
          The maximum amount of time that a queue is allowed to fall behind on the work that it's processing.
 int getMaxQueueSize()
          The maximum size of items the Async coordinator can hold.
 int getRateLimit()
          Sets the maximum number of operations to allow per second when AsyncConfig.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 is retried.
 long getWorkDelay()
          Returns the minimum amount of time to wait between individual work cycles.
 boolean isBatchingEnabled()
          Indicates whether to batch items.
 boolean isSynchronousWrite()
          Perform all writes to the Terracotta backend in a synchronous fashion, hence increasing reliability but decreasing performance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORK_DELAY

public static final long WORK_DELAY

MAX_ALLOWED_FALLBEHIND

public static final long MAX_ALLOWED_FALLBEHIND

BATCH_SIZE

public static final int BATCH_SIZE
See Also:
Constant Field Values

BATCHING_ENABLED

public static final boolean BATCHING_ENABLED
See Also:
Constant Field Values

SYNCHRONOUS_WRITE

public static final boolean SYNCHRONOUS_WRITE
See Also:
Constant Field Values

RETRY_ATTEMPTS

public static final int RETRY_ATTEMPTS
See Also:
Constant Field Values

RETRY_ATTEMPT_DELAY

public static final long RETRY_ATTEMPT_DELAY

RATE_LIMIT

public static final int RATE_LIMIT
See Also:
Constant Field Values

MAX_QUEUE_SIZE

public static final int MAX_QUEUE_SIZE
See Also:
Constant Field Values
Constructor Detail

DefaultAsyncConfig

protected DefaultAsyncConfig()
Method Detail

getInstance

public static AsyncConfig getInstance()
Return an AsyncConfig instance representing the default configuration.

Returns:
the default configuration

getWorkDelay

public long getWorkDelay()
Description copied from interface: AsyncConfig
Returns the minimum amount of time to wait between individual work cycles.

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

Specified by:
getWorkDelay in interface AsyncConfig
Returns:
the work delay that should be used, in milliseconds

getMaxAllowedFallBehind

public long getMaxAllowedFallBehind()
Description copied from interface: AsyncConfig
The maximum amount of time that a queue is allowed to fall behind on the work that it's processing.

Specified by:
getMaxAllowedFallBehind in interface AsyncConfig
Returns:
the maximum of time that the queue is allowed to fall behind, in milliseconds

getBatchSize

public int getBatchSize()
Description copied from interface: AsyncConfig
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.

Specified by:
getBatchSize in interface AsyncConfig
Returns:
the amount of items to batch

isBatchingEnabled

public boolean isBatchingEnabled()
Description copied from interface: AsyncConfig
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.

Specified by:
isBatchingEnabled in interface AsyncConfig
Returns:
true if items should be batched; false otherwise

isSynchronousWrite

public boolean isSynchronousWrite()
Description copied from interface: AsyncConfig
Perform all writes to the Terracotta backend in a synchronous fashion, hence increasing reliability but decreasing performance.

Specified by:
isSynchronousWrite in interface AsyncConfig
Returns:
true to enable synchronous writes; or false to perform the write asynchronously

getRetryAttempts

public int getRetryAttempts()
Description copied from interface: AsyncConfig
Retrieves the number of times the processing of an item is retried.

Specified by:
getRetryAttempts in interface AsyncConfig
Returns:
the number of tries before this pass is considered failed

getRetryAttemptDelay

public long getRetryAttemptDelay()
Description copied from interface: AsyncConfig
Retrieves the number of milliseconds to wait before retrying a failed operation.

Specified by:
getRetryAttemptDelay in interface AsyncConfig
Returns:
the delay in between retries, in milliseconds

getRateLimit

public int getRateLimit()
Description copied from interface: AsyncConfig
Sets the maximum number of operations to allow per second when AsyncConfig.isBatchingEnabled() is enabled.

Specified by:
getRateLimit in interface AsyncConfig
Returns:
the rate limit

getMaxQueueSize

public int getMaxQueueSize()
Description copied from interface: AsyncConfig
The maximum size of items the Async coordinator can hold.

Specified by:
getMaxQueueSize in interface AsyncConfig
Returns:


Copyright © 2003-2013 Terracotta, Inc.. All Rights Reserved.