org.terracotta.modules.ehcache.writebehind
Class WriteBehindAsyncConfig

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

public class WriteBehindAsyncConfig
extends Object
implements AsyncConfig

See Also:
Serialized Form

Constructor Summary
WriteBehindAsyncConfig(long workDelay, long maxAllowedFallBehind, boolean batchingEnabled, int batchSize, boolean synchronousWrite, int retryAttempts, long retryAttemptDelay, int rateLimit, int maxQueueSize)
           
 
Method Summary
 boolean equals(Object obj)
           
 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 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.
 int hashCode()
           
 boolean isBatchingEnabled()
          Indicates whether to batch items.
 boolean isStealingEnabled()
           
 boolean isSynchronousWrite()
          Perform all writes to the Terracotta backend in a synchronous fashion, hence increasing reliability but decreasing performance.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WriteBehindAsyncConfig

public WriteBehindAsyncConfig(long workDelay,
                              long maxAllowedFallBehind,
                              boolean batchingEnabled,
                              int batchSize,
                              boolean synchronousWrite,
                              int retryAttempts,
                              long retryAttemptDelay,
                              int rateLimit,
                              int maxQueueSize)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

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

isStealingEnabled

public boolean isStealingEnabled()

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

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

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:

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


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