|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.ehcache.config.CacheWriterConfiguration
public class CacheWriterConfiguration
Class to hold the CacheWriterManager configuration
Nested Class Summary | |
---|---|
static class |
CacheWriterConfiguration.CacheWriterFactoryConfiguration
Configuration for the CacheWriterFactoryConfiguration. |
static class |
CacheWriterConfiguration.WriteMode
Represents how elements are written to the CacheWriter |
Field Summary | |
---|---|
static int |
DEFAULT_MAX_WRITE_DELAY
Default maximum write delay |
static int |
DEFAULT_MIN_WRITE_DELAY
Default minimum write delay |
static boolean |
DEFAULT_NOTIFY_LISTENERS_ON_EXCEPTION
Default notifyListenersOnException behavior |
static int |
DEFAULT_RATE_LIMIT_PER_SECOND
Default rate limit per second |
static int |
DEFAULT_RETRY_ATTEMPT_DELAY_SECONDS
Default retry attempt delay |
static int |
DEFAULT_RETRY_ATTEMPTS
Default retry attempts |
static int |
DEFAULT_WRITE_BATCH_SIZE
Default write batch size |
static boolean |
DEFAULT_WRITE_BATCHING
Default writeBatching behavior |
static int |
DEFAULT_WRITE_BEHIND_CONCURRENCY
Default concurrency level for write behind |
static int |
DEFAULT_WRITE_BEHIND_MAX_QUEUE_SIZE
Default max queue size for write behind |
static boolean |
DEFAULT_WRITE_COALESCING
Default write coalescing behavior |
static CacheWriterConfiguration.WriteMode |
DEFAULT_WRITE_MODE
Default writeMode |
Constructor Summary | |
---|---|
CacheWriterConfiguration()
|
Method Summary | |
---|---|
void |
addCacheWriterFactory(CacheWriterConfiguration.CacheWriterFactoryConfiguration cacheWriterFactoryConfiguration)
Allows BeanHandler to add the CacheWriterFactory to the configuration. |
CacheWriterConfiguration |
cacheWriterFactory(CacheWriterConfiguration.CacheWriterFactoryConfiguration cacheWriterFactory)
|
CacheWriterConfiguration |
clone()
Clones this object, following the usual contract. |
boolean |
equals(Object obj)
Overrided equals() |
CacheWriterConfiguration.CacheWriterFactoryConfiguration |
getCacheWriterFactoryConfiguration()
Accessor |
int |
getMaxWriteDelay()
Get the maximum number of seconds to wait before writing behind |
int |
getMinWriteDelay()
Get the minimum number of seconds to wait before writing behind |
boolean |
getNotifyListenersOnException()
Check whether listeners should be notified when an exception occurs on a writer operation |
int |
getRateLimitPerSecond()
Get the maximum number of write operations to allow per second. |
int |
getRetryAttemptDelaySeconds()
Retrieves the number of seconds to wait before retrying an failed operation. |
int |
getRetryAttempts()
Retrieves the number of times the write of element is retried. |
boolean |
getWriteBatching()
Check whether write operations should be batched |
int |
getWriteBatchSize()
Retrieves the size of the batch operation. |
int |
getWriteBehindConcurrency()
Accessor |
int |
getWriteBehindMaxQueueSize()
Accessor |
boolean |
getWriteCoalescing()
|
CacheWriterConfiguration.WriteMode |
getWriteMode()
Get the write mode in terms of the mode enum |
int |
hashCode()
Overrided hashCode() |
CacheWriterConfiguration |
maxWriteDelay(int maxWriteDelay)
|
CacheWriterConfiguration |
minWriteDelay(int minWriteDelay)
|
CacheWriterConfiguration |
notifyListenersOnException(boolean notifyListenersOnException)
|
CacheWriterConfiguration |
rateLimitPerSecond(int rateLimitPerSecond)
|
CacheWriterConfiguration |
retryAttemptDelaySeconds(int retryAttemptDelaySeconds)
|
CacheWriterConfiguration |
retryAttempts(int retryAttempts)
|
void |
setMaxWriteDelay(int maxWriteDelay)
Set the maximum number of seconds to wait before writing behind. |
void |
setMinWriteDelay(int minWriteDelay)
Set the minimum number of seconds to wait before writing behind. |
void |
setNotifyListenersOnException(boolean notifyListenersOnException)
Sets whether to notify listeners when an exception occurs on a writer operation. |
void |
setRateLimitPerSecond(int rateLimitPerSecond)
Sets the maximum number of write operations to allow per second when writeBatching is enabled. |
void |
setRetryAttemptDelaySeconds(int retryAttemptDelaySeconds)
Sets the number of seconds to wait before retrying an failed operation. |
void |
setRetryAttempts(int retryAttempts)
Sets the number of times the operation is retried in the CacheWriter , this happens after the
original operation. |
void |
setWriteBatching(boolean writeBatching)
Sets whether to batch write operations. |
void |
setWriteBatchSize(int writeBatchSize)
Sets the number of operations to include in each batch when writeBatching is enabled. |
void |
setWriteBehindConcurrency(int concurrency)
Configures the amount of thread/bucket pairs WriteBehind should use |
void |
setWriteBehindMaxQueueSize(int writeBehindMaxQueueSize)
Configures the maximum amount of operations to be on the waiting queue, before it blocks |
void |
setWriteCoalescing(boolean writeCoalescing)
Sets whether to use write coalescing. |
void |
setWriteMode(String writeMode)
Converts the writeMode string argument to uppercase and looks up enum constant in WriteMode. |
void |
validate(Collection<ConfigError> errors)
Check for errors/inconsistencies in this configuration. |
CacheWriterConfiguration |
writeBatching(boolean writeBatching)
|
CacheWriterConfiguration |
writeBatchSize(int writeBatchSize)
|
CacheWriterConfiguration |
writeBehindConcurrency(int concurrency)
|
CacheWriterConfiguration |
writeBehindMaxQueueSize(int writeBehindMaxQueueSize)
|
CacheWriterConfiguration |
writeCoalescing(boolean writeCoalescing)
|
CacheWriterConfiguration |
writeMode(CacheWriterConfiguration.WriteMode writeMode)
|
CacheWriterConfiguration |
writeMode(String writeMode)
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final CacheWriterConfiguration.WriteMode DEFAULT_WRITE_MODE
public static final boolean DEFAULT_NOTIFY_LISTENERS_ON_EXCEPTION
public static final int DEFAULT_MIN_WRITE_DELAY
public static final int DEFAULT_MAX_WRITE_DELAY
public static final int DEFAULT_RATE_LIMIT_PER_SECOND
public static final boolean DEFAULT_WRITE_COALESCING
public static final boolean DEFAULT_WRITE_BATCHING
public static final int DEFAULT_WRITE_BATCH_SIZE
public static final int DEFAULT_RETRY_ATTEMPTS
public static final int DEFAULT_RETRY_ATTEMPT_DELAY_SECONDS
public static final int DEFAULT_WRITE_BEHIND_CONCURRENCY
public static final int DEFAULT_WRITE_BEHIND_MAX_QUEUE_SIZE
Constructor Detail |
---|
public CacheWriterConfiguration()
Method Detail |
---|
public CacheWriterConfiguration clone()
clone
in class Object
public void setWriteMode(String writeMode)
writeMode
string argument to uppercase and looks up enum constant in WriteMode.
public CacheWriterConfiguration writeMode(String writeMode)
setWriteMode(String)
public CacheWriterConfiguration writeMode(CacheWriterConfiguration.WriteMode writeMode)
setWriteMode(String)
public CacheWriterConfiguration.WriteMode getWriteMode()
public void setNotifyListenersOnException(boolean notifyListenersOnException)
notifyListenersOnException
- true
if listeners should be notified when an exception occurs on a writer operation; false
otherwisepublic CacheWriterConfiguration notifyListenersOnException(boolean notifyListenersOnException)
setNotifyListenersOnException(boolean)
public boolean getNotifyListenersOnException()
public void setMinWriteDelay(int minWriteDelay)
CacheWriter
performs its work very quickly, the overhead of processing the write behind queue items becomes very noticeable
in a cluster since all the operations might be done for individual items instead of for a collection of them.
This is only applicable to write behind mode.
Defaults to 1).
minWriteDelay
- the minimum number of seconds to wait before writing behindpublic CacheWriterConfiguration minWriteDelay(int minWriteDelay)
setMinWriteDelay(int)
public int getMinWriteDelay()
public void setMaxWriteDelay(int maxWriteDelay)
maxWriteDelay
- the maximum number of seconds to wait before writing behindpublic CacheWriterConfiguration maxWriteDelay(int maxWriteDelay)
setMaxWriteDelay(int)
public int getMaxWriteDelay()
public void setRateLimitPerSecond(int rateLimitPerSecond)
writeBatching
is enabled.
This is only applicable to write behind mode.
Defaults to 0.
rateLimitPerSecond
- the number of write operations to allow; use a number <=0
to disable rate limiting.public CacheWriterConfiguration rateLimitPerSecond(int rateLimitPerSecond)
setRateLimitPerSecond(int rateLimitPerSecond)
public int getRateLimitPerSecond()
public void setWriteCoalescing(boolean writeCoalescing)
true
and multiple operations on the same key are present
in the write-behind queue, only the latest write is done, as the others are redundant. This can dramatically
reduce load on the underlying resource.
This is only applicable to write behind mode.
Defaults to false.
writeCoalescing
- true
to enable write coalescing; or false
to disable itpublic CacheWriterConfiguration writeCoalescing(boolean writeCoalescing)
setWriteCoalescing(boolean)
public boolean getWriteCoalescing()
setWriteCoalescing(boolean)
public void setWriteBatching(boolean writeBatching)
true
, CacheWriter.writeAll(java.util.Collection)
and CacheWriter#deleteAll
will be called rather than CacheWriter.write(net.sf.ehcache.Element)
and CacheWriter.delete(net.sf.ehcache.CacheEntry)
being called for each key. Resources such
as databases can perform more efficiently if updates are batched, thus reducing load.
This is only applicable to write behind mode.
Defaults to false.
writeBatching
- true
if write operations should be batched; false
otherwisepublic CacheWriterConfiguration writeBatching(boolean writeBatching)
setWriteBatching(boolean)
public boolean getWriteBatching()
public void setWriteBatchSize(int writeBatchSize)
writeBatching
is enabled. If there are less
entries in the write-behind queue than the batch size, the queue length size is used.
This is only applicable to write behind mode.
Defaults to 1.
writeBatchSize
- the number of operations to include in each batch; numbers smaller than 1
will cause
the default batch size to be usedpublic CacheWriterConfiguration writeBatchSize(int writeBatchSize)
setWriteBatchSize(int)
public int getWriteBatchSize()
public void setRetryAttempts(int retryAttempts)
CacheWriter
, this happens after the
original operation.
This is only applicable to write behind mode.
Defaults to 0.
retryAttempts
- the number of retries for a particular elementpublic CacheWriterConfiguration retryAttempts(int retryAttempts)
setRetryAttempts(int)
public int getRetryAttempts()
public void setRetryAttemptDelaySeconds(int retryAttemptDelaySeconds)
retryAttemptDelaySeconds
- the number of seconds to wait before retrying an operationpublic CacheWriterConfiguration retryAttemptDelaySeconds(int retryAttemptDelaySeconds)
setRetryAttemptDelaySeconds(int)
public int getRetryAttemptDelaySeconds()
public final void addCacheWriterFactory(CacheWriterConfiguration.CacheWriterFactoryConfiguration cacheWriterFactoryConfiguration)
public CacheWriterConfiguration cacheWriterFactory(CacheWriterConfiguration.CacheWriterFactoryConfiguration cacheWriterFactory)
addCacheWriterFactory(CacheWriterFactoryConfiguration)
public CacheWriterConfiguration.CacheWriterFactoryConfiguration getCacheWriterFactoryConfiguration()
public void setWriteBehindConcurrency(int concurrency)
concurrency
- Amount of thread/bucket pairs, has to be at least 1public CacheWriterConfiguration writeBehindConcurrency(int concurrency)
concurrency
- Amount of thread/bucket pairs, has to be at least 1
setWriteBehindConcurrency(int)
public int getWriteBehindConcurrency()
public void setWriteBehindMaxQueueSize(int writeBehindMaxQueueSize)
writeBehindMaxQueueSize
- maximum amount of operations allowed on the waiting queuepublic int getWriteBehindMaxQueueSize()
public CacheWriterConfiguration writeBehindMaxQueueSize(int writeBehindMaxQueueSize)
writeBehindMaxQueueSize
- maximum amount of operations allowed on the waiting queue
setWriteBehindMaxQueueSize(int)
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public void validate(Collection<ConfigError> errors)
ConfigError
in the errors collection.
errors
- collection to add errors to.
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |