org.ehcache.config.builders
Class WriteBehindConfigurationBuilder

java.lang.Object
  extended by org.ehcache.config.builders.WriteBehindConfigurationBuilder
All Implemented Interfaces:
Builder<WriteBehindConfiguration>
Direct Known Subclasses:
WriteBehindConfigurationBuilder.BatchedWriteBehindConfigurationBuilder, WriteBehindConfigurationBuilder.UnBatchedWriteBehindConfigurationBuilder

public abstract class WriteBehindConfigurationBuilder
extends java.lang.Object
implements Builder<WriteBehindConfiguration>

The WriteBehindConfigurationBuilder enables building WriteBehindConfigurations using a fluent style.

As with all Ehcache builders, all instances are immutable and calling any method on the builder will return a new instance without modifying the one on which the method was called. This enables the sharing of builder instances without any risk of seeing them modified by code elsewhere.


Nested Class Summary
static class WriteBehindConfigurationBuilder.BatchedWriteBehindConfigurationBuilder
          Specialized WriteBehindConfigurationBuilder for WriteBehindConfigurations that supports batching
static class WriteBehindConfigurationBuilder.UnBatchedWriteBehindConfigurationBuilder
          Specialized WriteBehindConfigurationBuilder for WriteBehindConfigurations without batching support
 
Field Summary
protected  int concurrency
           
protected  int queueSize
           
protected  java.lang.String threadPoolAlias
           
 
Method Summary
abstract  WriteBehindConfigurationBuilder concurrencyLevel(int concurrency)
          Sets the concurrency level on the returned builder.
static WriteBehindConfigurationBuilder.BatchedWriteBehindConfigurationBuilder newBatchedWriteBehindConfiguration(long maxDelay, java.util.concurrent.TimeUnit maxDelayUnit, int batchSize)
          Creates a new builder for WriteBehindConfiguration that supports batching.
static WriteBehindConfigurationBuilder.UnBatchedWriteBehindConfigurationBuilder newUnBatchedWriteBehindConfiguration()
          Creates a new builder for WriteBehindConfiguration without batching support.
abstract  WriteBehindConfigurationBuilder queueSize(int size)
          Sets the batch queue size on the returned builder.
abstract  WriteBehindConfigurationBuilder useThreadPool(java.lang.String alias)
          Sets the thread pool to use for write behind on the returned builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ehcache.config.builders.Builder
build
 

Field Detail

concurrency

protected int concurrency

queueSize

protected int queueSize

threadPoolAlias

protected java.lang.String threadPoolAlias
Method Detail

newBatchedWriteBehindConfiguration

public static WriteBehindConfigurationBuilder.BatchedWriteBehindConfigurationBuilder newBatchedWriteBehindConfiguration(long maxDelay,
                                                                                                                        java.util.concurrent.TimeUnit maxDelayUnit,
                                                                                                                        int batchSize)
Creates a new builder for WriteBehindConfiguration that supports batching.

Parameters:
maxDelay - the max delay for a batch
maxDelayUnit - the max delay unit
batchSize - the batch size
Returns:
a new builder

newUnBatchedWriteBehindConfiguration

public static WriteBehindConfigurationBuilder.UnBatchedWriteBehindConfigurationBuilder newUnBatchedWriteBehindConfiguration()
Creates a new builder for WriteBehindConfiguration without batching support.

Returns:
a new builder

queueSize

public abstract WriteBehindConfigurationBuilder queueSize(int size)
Sets the batch queue size on the returned builder.

Default queue size is Integer.MAX_VALUE.

Parameters:
size - the new queue size
Returns:
a new builder with updated queue size

concurrencyLevel

public abstract WriteBehindConfigurationBuilder concurrencyLevel(int concurrency)
Sets the concurrency level on the returned builder.

Default concurrency is 1.

Parameters:
concurrency - the concurrency level
Returns:
a new builder with the new concurrency level

useThreadPool

public abstract WriteBehindConfigurationBuilder useThreadPool(java.lang.String alias)
Sets the thread pool to use for write behind on the returned builder.

Parameters:
alias - the thread pool alias
Returns:
a new builer with the configured thread pool alias
See Also:
PooledExecutionServiceConfigurationBuilder