Top Description Inners Fields Constructors Methods
net.sf.ehcache.config

public Class TerracottaConfiguration

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
org.slf4j.Logger, .LoggerFactory

Class to hold the Terracotta configuration - either a pointer to the real config or a container for embedded config.
Authors
Alex Miller, Geert Bevin, Abhishek Sanoujam

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
TerracottaConfiguration.Consistency

Enum for various consistency settings

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private volatile boolean
private int
private TerracottaConfiguration.Consistency
private boolean
public static final boolean
DEFAULT_CACHE_COHERENT

Default cache coherence setting

public static final boolean
DEFAULT_CACHE_XA

Default xa enabled

public static final boolean
DEFAULT_CLUSTERED

Default clustered mode

public static final boolean
DEFAULT_COHERENT_READS

Default coherent read behavior

public static final boolean
DEFAULT_COMPRESSION_ENABLED

Default compression setting

public static final int
DEFAULT_CONCURRENCY

Default value for concurrency of the internal Store.

public static final TerracottaConfiguration.Consistency
DEFAULT_CONSISTENCY_TYPE

Default cache consistency setting

public static final boolean
DEFAULT_COPY_ON_READ

Default copy on read setting

public static final boolean
DEFAULT_LOCAL_CACHE_ENABLED

Default value for whether local cache is enabled or not

public static final boolean
DEFAULT_LOCAL_KEY_CACHE

Default local key cache status

public static final int
DEFAULT_LOCAL_KEY_CACHE_SIZE

Default local key cache size

public static final NonstopConfiguration
public static final boolean
DEFAULT_ORPHAN_EVICTION

Default orphan eviction status

public static final int
DEFAULT_ORPHAN_EVICTION_PERIOD

Default orphan eviction period

public static final boolean
DEFAULT_SYNCHRONOUS_WRITES

Default setting for synchronous-write

private boolean
private volatile boolean
private boolean
private int
private static final Logger
private NonstopConfiguration
private boolean
private int
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
private void
public TerracottaConfiguration

Returns:

this configuration instance
cacheXA
(boolean cacheXA)

public TerracottaConfiguration

Returns:

a copy, which independent other than configurations than cannot change.
clone
()

Overrides java.lang.Object.clone.

Clones this object, following the usual contract.
public TerracottaConfiguration

Returns:

this configuration instance
clustered
(boolean clustered)

public TerracottaConfiguration

Returns:

this configuration instance
coherent
(boolean coherent)

Deprecated since 2.4 Use consistency(Consistency) instead
public TerracottaConfiguration

Returns:

this configuration instance
coherentReads
(boolean coherentReads)

Deprecated
public TerracottaConfiguration

Returns:

this configuration instance
compressionEnabled
(boolean enabled)

public TerracottaConfiguration

Returns:

this configuration instance
concurrency
(final int concurrency)

public TerracottaConfiguration

Returns:

this instance
consistency
(TerracottaConfiguration.Consistency consistency)

Setter for consistency, returns this instance

public TerracottaConfiguration

Returns:

this configuration instance
copyOnRead
(boolean isCopyOnRead)

Deprecated
public boolean
getCoherentReads()

Deprecated
Check whether coherent reads are enabled
public int
getConcurrency()

Get the value of concurrency.

public TerracottaConfiguration.Consistency

Returns:

the consistency
getConsistency
()

Getter for consistency

public boolean
getLocalKeyCache()

Check whether the local key cache is enabled

public int
getLocalKeyCacheSize()

Get the size limit of the local key cache (if enabled)

public NonstopConfiguration

Returns:

the NonstopConfiguration, may be null
getNonstopConfiguration
()

Get the NonstopConfiguration, may be null

public boolean
getOrphanEviction()

Check whether orphan eviction is enabled

public int
getOrphanEvictionPeriod()

Get the number of regular eviction cycles between orphan evictions

public boolean
isCacheXA()

Check whether the [serialized value] cache is an XA enabled cache

public boolean
isClustered()

Check whether clustering is enabled

public boolean

Returns:

true if configured in coherent mode.
isCoherent
()

Deprecated since 2.4 Use getConsistency() instead to query the Consistency or Ehcache#isNodeCoherent() to query if the node is coherent
Is the cache configured for coherent or incoherent mode.
public boolean
isCompressionEnabled()

Check whether compression is enabled

public boolean
isCopyOnRead()

Deprecated
Check whether the [serialized value] cache should use copy on read semantics
pack-priv boolean

Returns:

true if set by config
isCopyOnReadSet
()

Whether the copyOnRead was explicitly set

public boolean

Returns:

true if local cache is enabled, otherwise false
isLocalCacheEnabled
()

Returns true if local cache is enabled, otherwise false

public boolean

Returns:

true if nonstop is enabled
isNonstopEnabled
()

Returns true if nonstop is enabled

public boolean

Returns:

true if configured for synchronouse-write, otherwise false. Default is false
isSynchronousWrites
()

Is the cache configured for synchronous-write?

public TerracottaConfiguration

Returns:

this instance
localCacheEnabled
(final boolean localCacheEnabled)

Enable or disable the local cache

public TerracottaConfiguration

Returns:

this configuration instance
localKeyCache
(boolean localKeyCache)

public TerracottaConfiguration

Returns:

this configuration instance
localKeyCacheSize
(int localKeyCacheSize)

private static NonstopConfiguration
public TerracottaConfiguration

Returns:

this configuration instance
nonstop
(NonstopConfiguration nonstopConfiguration)

Set the NonstopConfiguration

public TerracottaConfiguration

Returns:

this configuration instance
orphanEviction
(boolean orphanEviction)

public TerracottaConfiguration

Returns:

this configuration instance
orphanEvictionPeriod
(int orphanEvictionPeriod)

public void
setCacheXA(boolean cacheXA)

Used by BeanHandler to set the cacheXA flag during parsing

public void
setClustered(boolean
true if the cache should be clustered with Terracotta; false otherwise
clustered
)

Indicates whether to cluster this cache with Terracotta.

public void
setCoherent(boolean coherent)

Deprecated since 2.4 Use setConsistency(Consistency) instead
Used by BeanHandler to set the coherent during parsing
public void
setCoherentReads(boolean
true if coherent reads should be used; false otherwise
coherentReads
)

Deprecated
Sets whether this cache should use coherent reads (usually should be true unless optimizing for read-only).
public void
setCompressionEnabled(boolean enabled)

Used by BeanHandler to set the compressionEnabled flag during parsing

public void
setConcurrency(final int concurrency)

Sets the value of concurrency.

public void
setConsistency(TerracottaConfiguration.Consistency consistency)

Setter for consistency

public void
setConsistency(String consistency)

Setter for consistency

public void
setCopyOnRead(boolean isCopyOnRead)

Deprecated
Used by BeanHandler to set the copyOnRead flag during parsing
public void
setLocalCacheEnabled(final boolean localCacheEnabled)

Enable or disable the local cache

public void
setLocalKeyCache(boolean
true if a local key cache should be used; false otherwise
localKeyCache
)

Sets whether this cache should use an unclustered local key cache (usually should be false unless optimizing for a small read-only cache)

Defaults to false.

public void
setLocalKeyCacheSize(int
the size of the local key cache in number of keys
localKeyCacheSize
)

Sets maximum size of the local key cache (usually the size of the key set of the cache or cache partition).

public void
setOrphanEviction(boolean
true if orphan eviction should be used; false otherwise
orphanEviction
)

Sets whether this cache should perform orphan eviction (usually should be true).

public void
setOrphanEvictionPeriod(int
every how many regular evictions an orphan eviction should occur
orphanEvictionPeriod
)

Set how often this cache should perform orphan eviction (measured in regular eviction periods).

public void
setSynchronousWrites(boolean
true for using synchronous-write
synchronousWrites
)

Set the value for synchronous-write

public TerracottaConfiguration

Returns:

this configuration instance
synchronousWrites
(boolean synchronousWrites)

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheXAback to summary
private boolean cacheXA
clusteredback to summary
private boolean clustered
coherentReadsback to summary
private boolean coherentReads
compressionEnabledback to summary
private volatile boolean compressionEnabled
concurrencyback to summary
private int concurrency
consistencyback to summary
private TerracottaConfiguration.Consistency consistency
copyOnReadSetback to summary
private boolean copyOnReadSet
DEFAULT_CACHE_COHERENTback to summary
public static final boolean DEFAULT_CACHE_COHERENT

Deprecated

since 2.4 Use DEFAULT_CONSISTENCY_TYPE instead.

Default cache coherence setting

Annotations
@Deprecated
DEFAULT_CACHE_XAback to summary
public static final boolean DEFAULT_CACHE_XA

Default xa enabled

DEFAULT_CLUSTEREDback to summary
public static final boolean DEFAULT_CLUSTERED

Default clustered mode

DEFAULT_COHERENT_READSback to summary
public static final boolean DEFAULT_COHERENT_READS

Default coherent read behavior

DEFAULT_COMPRESSION_ENABLEDback to summary
public static final boolean DEFAULT_COMPRESSION_ENABLED

Default compression setting

DEFAULT_CONCURRENCYback to summary
public static final int DEFAULT_CONCURRENCY

Default value for concurrency of the internal Store.

DEFAULT_CONSISTENCY_TYPEback to summary
public static final TerracottaConfiguration.Consistency DEFAULT_CONSISTENCY_TYPE

Default cache consistency setting

DEFAULT_COPY_ON_READback to summary
public static final boolean DEFAULT_COPY_ON_READ

Default copy on read setting

DEFAULT_LOCAL_CACHE_ENABLEDback to summary
public static final boolean DEFAULT_LOCAL_CACHE_ENABLED

Default value for whether local cache is enabled or not

DEFAULT_LOCAL_KEY_CACHEback to summary
public static final boolean DEFAULT_LOCAL_KEY_CACHE

Default local key cache status

DEFAULT_LOCAL_KEY_CACHE_SIZEback to summary
public static final int DEFAULT_LOCAL_KEY_CACHE_SIZE

Default local key cache size

DEFAULT_NON_STOP_CONFIGURATIONback to summary
public static final NonstopConfiguration DEFAULT_NON_STOP_CONFIGURATION

Default value for NonstopConfiguration

DEFAULT_ORPHAN_EVICTIONback to summary
public static final boolean DEFAULT_ORPHAN_EVICTION

Default orphan eviction status

DEFAULT_ORPHAN_EVICTION_PERIODback to summary
public static final int DEFAULT_ORPHAN_EVICTION_PERIOD

Default orphan eviction period

DEFAULT_SYNCHRONOUS_WRITESback to summary
public static final boolean DEFAULT_SYNCHRONOUS_WRITES

Default setting for synchronous-write

isCopyOnReadback to summary
private boolean isCopyOnRead
localCacheEnabledback to summary
private volatile boolean localCacheEnabled
localKeyCacheback to summary
private boolean localKeyCache
localKeyCacheSizeback to summary
private int localKeyCacheSize
LOGback to summary
private static final Logger LOG
nonStopConfigurationback to summary
private NonstopConfiguration nonStopConfiguration
orphanEvictionback to summary
private boolean orphanEviction
orphanEvictionPeriodback to summary
private int orphanEvictionPeriod
synchronousWritesback to summary
private boolean synchronousWrites

Constructor Detail

TerracottaConfigurationback to summary
public TerracottaConfiguration()

Method Detail

addNonstopback to summary
public void addNonstop(NonstopConfiguration nonstopConfiguration)

Add the NonstopConfiguration

assertArgumentNotNullback to summary
private void assertArgumentNotNull(String name, Object object)
cacheXAback to summary
public TerracottaConfiguration cacheXA(boolean cacheXA)
Returns:TerracottaConfiguration

this configuration instance

See Also
setCacheXA(boolean)
cloneback to summary
public TerracottaConfiguration clone()

Overrides java.lang.Object.clone.

Clones this object, following the usual contract.

Returns:TerracottaConfiguration

a copy, which independent other than configurations than cannot change.

Annotations
@Override
clusteredback to summary
public TerracottaConfiguration clustered(boolean clustered)
Returns:TerracottaConfiguration

this configuration instance

See Also
setClustered(boolean)
coherentback to summary
public TerracottaConfiguration coherent(boolean coherent)

Deprecated

since 2.4 Use consistency(Consistency) instead

Returns:TerracottaConfiguration

this configuration instance

Annotations
@Deprecated
coherentReadsback to summary
public TerracottaConfiguration coherentReads(boolean coherentReads)

Deprecated

Returns:TerracottaConfiguration

this configuration instance

Annotations
@Deprecated
See Also
setCoherentReads(boolean)
compressionEnabledback to summary
public TerracottaConfiguration compressionEnabled(boolean enabled)
Returns:TerracottaConfiguration

this configuration instance

concurrencyback to summary
public TerracottaConfiguration concurrency(final int concurrency)
Returns:TerracottaConfiguration

this configuration instance

See Also
setConcurrency(int)
consistencyback to summary
public TerracottaConfiguration consistency(TerracottaConfiguration.Consistency consistency)

Setter for consistency, returns this instance

Returns:TerracottaConfiguration

this instance

copyOnReadback to summary
public TerracottaConfiguration copyOnRead(boolean isCopyOnRead)

Deprecated

Returns:TerracottaConfiguration

this configuration instance

Annotations
@Deprecated
See Also
setCopyOnRead(boolean)
getCoherentReadsback to summary
public boolean getCoherentReads()

Deprecated

Check whether coherent reads are enabled

Annotations
@Deprecated
getConcurrencyback to summary
public int getConcurrency()

Get the value of concurrency. This value cannot be changed once cache is initialized.

getConsistencyback to summary
public TerracottaConfiguration.Consistency getConsistency()

Getter for consistency

Returns:TerracottaConfiguration.Consistency

the consistency

getLocalKeyCacheback to summary
public boolean getLocalKeyCache()

Check whether the local key cache is enabled

getLocalKeyCacheSizeback to summary
public int getLocalKeyCacheSize()

Get the size limit of the local key cache (if enabled)

getNonstopConfigurationback to summary
public NonstopConfiguration getNonstopConfiguration()

Get the NonstopConfiguration, may be null

Returns:NonstopConfiguration

the NonstopConfiguration, may be null

getOrphanEvictionback to summary
public boolean getOrphanEviction()

Check whether orphan eviction is enabled

getOrphanEvictionPeriodback to summary
public int getOrphanEvictionPeriod()

Get the number of regular eviction cycles between orphan evictions

isCacheXAback to summary
public boolean isCacheXA()

Check whether the [serialized value] cache is an XA enabled cache

isClusteredback to summary
public boolean isClustered()

Check whether clustering is enabled

isCoherentback to summary
public boolean isCoherent()

Deprecated

since 2.4 Use getConsistency() instead to query the Consistency or Ehcache#isNodeCoherent() to query if the node is coherent

Is the cache configured for coherent or incoherent mode.

Returns:boolean

true if configured in coherent mode.

Annotations
@Deprecated
isCompressionEnabledback to summary
public boolean isCompressionEnabled()

Check whether compression is enabled

isCopyOnReadback to summary
public boolean isCopyOnRead()

Deprecated

Check whether the [serialized value] cache should use copy on read semantics

Annotations
@Deprecated
isCopyOnReadSetback to summary
pack-priv boolean isCopyOnReadSet()

Whether the copyOnRead was explicitly set

Returns:boolean

true if set by config

isLocalCacheEnabledback to summary
public boolean isLocalCacheEnabled()

Returns true if local cache is enabled, otherwise false

Returns:boolean

true if local cache is enabled, otherwise false

isNonstopEnabledback to summary
public boolean isNonstopEnabled()

Returns true if nonstop is enabled

Returns:boolean

true if nonstop is enabled

isSynchronousWritesback to summary
public boolean isSynchronousWrites()

Is the cache configured for synchronous-write?

Returns:boolean

true if configured for synchronouse-write, otherwise false. Default is false

localCacheEnabledback to summary
public TerracottaConfiguration localCacheEnabled(final boolean localCacheEnabled)

Enable or disable the local cache

Returns:TerracottaConfiguration

this instance

localKeyCacheback to summary
public TerracottaConfiguration localKeyCache(boolean localKeyCache)
Returns:TerracottaConfiguration

this configuration instance

See Also
setLocalKeyCache(boolean)
localKeyCacheSizeback to summary
public TerracottaConfiguration localKeyCacheSize(int localKeyCacheSize)
Returns:TerracottaConfiguration

this configuration instance

See Also
setLocalKeyCacheSize(int)
makeDefaultNonstopConfigurationback to summary
private static NonstopConfiguration makeDefaultNonstopConfiguration()
nonstopback to summary
public TerracottaConfiguration nonstop(NonstopConfiguration nonstopConfiguration)

Set the NonstopConfiguration

Returns:TerracottaConfiguration

this configuration instance

orphanEvictionback to summary
public TerracottaConfiguration orphanEviction(boolean orphanEviction)
Returns:TerracottaConfiguration

this configuration instance

See Also
setOrphanEviction(boolean)
orphanEvictionPeriodback to summary
public TerracottaConfiguration orphanEvictionPeriod(int orphanEvictionPeriod)
Returns:TerracottaConfiguration

this configuration instance

See Also
setOrphanEvictionPeriod(int)
setCacheXAback to summary
public void setCacheXA(boolean cacheXA)

Used by BeanHandler to set the cacheXA flag during parsing

setClusteredback to summary
public void setClustered(boolean clustered)

Indicates whether to cluster this cache with Terracotta.

Defaults to true.

Parameters
clustered:boolean

true if the cache should be clustered with Terracotta; false otherwise

setCoherentback to summary
public void setCoherent(boolean coherent)

Deprecated

since 2.4 Use setConsistency(Consistency) instead

Used by BeanHandler to set the coherent during parsing

Annotations
@Deprecated
setCoherentReadsback to summary
public void setCoherentReads(boolean coherentReads)

Deprecated

Sets whether this cache should use coherent reads (usually should be true unless optimizing for read-only).

Defaults to true.

Parameters
coherentReads:boolean

true if coherent reads should be used; false otherwise

Annotations
@Deprecated
setCompressionEnabledback to summary
public void setCompressionEnabled(boolean enabled)

Used by BeanHandler to set the compressionEnabled flag during parsing

setConcurrencyback to summary
public void setConcurrency(final int concurrency)

Sets the value of concurrency. Throws IllegalArgumentException if the value is less than 0. This value cannot be changed once cache is initialized.

setConsistencyback to summary
public void setConsistency(TerracottaConfiguration.Consistency consistency)

Setter for consistency

setConsistencyback to summary
public void setConsistency(String consistency)

Setter for consistency

setCopyOnReadback to summary
public void setCopyOnRead(boolean isCopyOnRead)

Deprecated

Used by BeanHandler to set the copyOnRead flag during parsing

Annotations
@Deprecated
setLocalCacheEnabledback to summary
public void setLocalCacheEnabled(final boolean localCacheEnabled)

Enable or disable the local cache

setLocalKeyCacheback to summary
public void setLocalKeyCache(boolean localKeyCache)

Sets whether this cache should use an unclustered local key cache (usually should be false unless optimizing for a small read-only cache)

Defaults to false.

Parameters
localKeyCache:boolean

true if a local key cache should be used; false otherwise

setLocalKeyCacheSizeback to summary
public void setLocalKeyCacheSize(int localKeyCacheSize)

Sets maximum size of the local key cache (usually the size of the key set of the cache or cache partition).

Defaults to 300000.

Parameters
localKeyCacheSize:int

the size of the local key cache in number of keys

setOrphanEvictionback to summary
public void setOrphanEviction(boolean orphanEviction)

Sets whether this cache should perform orphan eviction (usually should be true).

Orphans are elements that are not present on any node in the cluster anymore and hence need additional routines to be detected since they're not locally available anywhere.

Defaults to true.

Parameters
orphanEviction:boolean

true if orphan eviction should be used; false otherwise

setOrphanEvictionPeriodback to summary
public void setOrphanEvictionPeriod(int orphanEvictionPeriod)

Set how often this cache should perform orphan eviction (measured in regular eviction periods).

Defaults to 4).

Parameters
orphanEvictionPeriod:int

every how many regular evictions an orphan eviction should occur

setSynchronousWritesback to summary
public void setSynchronousWrites(boolean synchronousWrites)

Set the value for synchronous-write

Parameters
synchronousWrites:boolean

true for using synchronous-write

synchronousWritesback to summary
public TerracottaConfiguration synchronousWrites(boolean synchronousWrites)
Returns:TerracottaConfiguration

this configuration instance

See Also
setSynchronousWrites(boolean)
net.sf.ehcache.config back to summary

public final Enum TerracottaConfiguration.Consistency

extends Enum<TerracottaConfiguration.Consistency>
Class Inheritance

Enum for various consistency settings
Author
Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
public static final TerracottaConfiguration.Consistency
EVENTUAL

Eventual consistency

public static final TerracottaConfiguration.Consistency
STRONG

Strong consistency

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TerracottaConfiguration.Consistency
public static TerracottaConfiguration.Consistency[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

EVENTUALback to summary
public static final TerracottaConfiguration.Consistency EVENTUAL

Eventual consistency

STRONGback to summary
public static final TerracottaConfiguration.Consistency STRONG

Strong consistency

Constructor Detail

Consistencyback to summary
private Consistency()

Method Detail

valueOfback to summary
public static TerracottaConfiguration.Consistency valueOf(String name)
valuesback to summary
public static TerracottaConfiguration.Consistency[] values()