org.jboss.cache.config
Class Configuration

java.lang.Object
  extended by org.jboss.cache.config.ConfigurationComponent
      extended by org.jboss.cache.config.Configuration
All Implemented Interfaces:
Serializable, Cloneable, CloneableConfigurationComponent

public class Configuration
extends ConfigurationComponent

Encapsulates the configuration of a Cache.

Author:
Manik Surtani (manik AT jboss DOT org)
See Also:
Serialized Form

Nested Class Summary
static class Configuration.CacheMode
          Cache replication mode.
static class Configuration.NodeLockingScheme
          Cache node locking scheme.
static class Configuration.ShutdownHookBehavior
          Behavior of the JVM shutdown hook registered by the cache
 
Field Summary
static short DEFAULT_REPLICATION_VERSION
          Default replication version, from Version.getVersionShort().
 
Fields inherited from class org.jboss.cache.config.ConfigurationComponent
log
 
Constructor Summary
Configuration()
           
 
Method Summary
 Configuration clone()
           
 boolean equals(Object o)
           
 BuddyReplicationConfig getBuddyReplicationConfig()
           
 CacheLoaderConfig getCacheLoaderConfig()
           
 Configuration.CacheMode getCacheMode()
           
 String getCacheModeString()
           
 String getClusterConfig()
           
 String getClusterName()
           
 int getConcurrencyLevel()
           
 BuddyManager getConsistentHashing()
           
 List<CustomInterceptorConfig> getCustomInterceptors()
          Returns the CustomInterceptorConfig, if any, associated with this configuration object.
 URL getDefaultClusterConfig()
          Returns a URL to a default JGroups configuration file.
 EvictionConfig getEvictionConfig()
           
 boolean getExposeManagementStatistics()
          Deprecated. use isExposeManagementStatistics()
 IsolationLevel getIsolationLevel()
           
 String getIsolationLevelString()
           
 URL getJGroupsConfigFile()
           
 int getListenerAsyncPoolSize()
          Gets the size of the asynchronous listener notification thread pool size.
 int getListenerAsyncQueueSize()
           
 long getLockAcquisitionTimeout()
           
 Marshaller getMarshaller()
           
 String getMarshallerClass()
           
 String getMultiplexerStack()
           
 String getMuxStackName()
           
 Configuration.NodeLockingScheme getNodeLockingScheme()
          Deprecated. will be removed once optimistic and pessimistic locking is removed.
 String getNodeLockingSchemeString()
           
 int getObjectInputStreamPoolSize()
           
 int getObjectOutputStreamPoolSize()
           
 short getReplicationVersion()
           
 long getReplQueueInterval()
           
 int getReplQueueMaxElements()
           
 String getReplVersionString()
           
 RuntimeConfig getRuntimeConfig()
           
 int getSerializationExecutorPoolSize()
           
 int getSerializationExecutorQueueSize()
           
 Configuration.ShutdownHookBehavior getShutdownHookBehavior()
           
 long getStateRetrievalTimeout()
           
 long getSyncReplTimeout()
           
 String getTransactionManagerLookupClass()
           
 int hashCode()
           
 boolean isExposeManagementStatistics()
           
 boolean isFetchInMemoryState()
           
 boolean isInactiveOnStartup()
           
 boolean isInvocationBatchingEnabled()
           
 boolean isLockParentForChildInsertRemove()
          Gets whether inserting or removing a node requires a write lock on the node's parent (when pessimistic locking is used.)

The default value is false

 boolean isNodeLockingOptimistic()
          Deprecated. use getNodeLockingScheme() to determine node locking scheme used.
 boolean isNonBlockingStateTransfer()
           
 boolean isSyncCommitPhase()
           
 boolean isSyncRollbackPhase()
           
 boolean isUseLazyDeserialization()
           
 boolean isUseRegionBasedMarshalling()
           
 boolean isUseReplQueue()
           
 boolean isUsingBuddyReplication()
           
 boolean isUsingCacheLoaders()
           
 boolean isUsingMultiplexer()
           
 boolean isWriteSkewCheck()
           
static Configuration.CacheMode legacyModeToCacheMode(int legacyMode)
           
 void setBuddyReplicationConfig(BuddyReplicationConfig config)
           
 void setCacheLoaderConfig(CacheLoaderConfig config)
           
 void setCacheMarshaller(Marshaller instance)
           
 void setCacheMode(Configuration.CacheMode cacheModeInt)
           
 void setCacheMode(String cacheMode)
           
 void setCacheModeString(String cacheMode)
           
 void setClusterConfig(Element config)
          Converts a list of elements to a Java Groups property string.
 void setClusterConfig(String clusterConfig)
           
 void setClusterName(String clusterName)
           
 void setConcurrencyLevel(int concurrencyLevel)
           
 void setCustomInterceptors(List<CustomInterceptorConfig> customInterceptors)
           
 void setEvictionConfig(EvictionConfig config)
           
 void setExposeManagementStatistics(boolean useMbean)
           
 void setFetchInMemoryState(boolean fetchInMemoryState)
           
 void setInactiveOnStartup(boolean inactiveOnStartup)
           
 void setInvocationBatchingEnabled(boolean enabled)
          Enables invocation batching if set to true.
 void setIsolationLevel(IsolationLevel isolationLevel)
           
 void setIsolationLevel(String isolationLevel)
           
 void setIsolationLevelString(String isolationLevel)
           
 void setJgroupsConfigFile(URL jgroupsConfigFile)
           
 void setListenerAsyncPoolSize(int listenerAsyncPoolSize)
          Sets the size of the asynchronous listener notification thread pool size.
 void setListenerAsyncQueueSize(int listenerAsyncQueueSize)
          Sets the queue size of the bounded queue used to store async listener events on.
 void setLockAcquisitionTimeout(long lockAcquisitionTimeout)
           
 void setLockParentForChildInsertRemove(boolean lockParentForChildInsertRemove)
          Sets whether inserting or removing a node requires a write lock on the node's parent (when pessimistic locking is used.)

The default value is false

 void setMarshallerClass(String marshallerClass)
           
 void setMultiplexerStack(String stackName)
           
 void setMuxStackName(String muxStackName)
           
 void setNodeLockingOptimistic(boolean nodeLockingOptimistic)
          Deprecated. 
 void setNodeLockingScheme(Configuration.NodeLockingScheme nodeLockingScheme)
          Deprecated. will default to MVCC once optimistic and pessimistic schemes are removed.
 void setNodeLockingScheme(String nodeLockingScheme)
           
 void setNodeLockingSchemeString(String nodeLockingScheme)
           
 void setNonBlockingStateTransfer(boolean nonBlockingStateTransfer)
           
 void setObjectInputStreamPoolSize(int objectInputStreamPoolSize)
          Initialises the size of the object input stream pool size, which defaults to 50.
 void setObjectOutputStreamPoolSize(int objectOutputStreamPoolSize)
          Initialises the size of the object output stream pool size, which defaults to 50.
 void setReplicationVersion(short replicationVersion)
           
 void setReplQueueInterval(long replQueueInterval)
           
 void setReplQueueMaxElements(int replQueueMaxElements)
           
 void setReplVersionString(String replVersionString)
           
 void setRuntimeConfig(RuntimeConfig runtimeConfig)
           
 void setSerializationExecutorPoolSize(int serializationExecutorPoolSize)
          Sets the async replication serialization executor pool size for async replication.
 void setSerializationExecutorQueueSize(int serializationExecutorQueueSize)
          Sets the queue size of the bounded queue used to store async serialization events on.
 void setShutdownHookBehavior(Configuration.ShutdownHookBehavior shutdownHookBehavior)
           
 void setShutdownHookBehavior(String shutdownHookBehavior)
           
 void setStateRetrievalTimeout(long stateRetrievalTimeout)
           
 void setSyncCommitPhase(boolean syncCommitPhase)
           
 void setSyncReplTimeout(long syncReplTimeout)
           
 void setSyncRollbackPhase(boolean syncRollbackPhase)
           
 void setTransactionManagerLookupClass(String transactionManagerLookupClass)
           
 void setUseLazyDeserialization(boolean useLazyDeserialization)
           
 void setUseRegionBasedMarshalling(boolean useRegionBasedMarshalling)
          This is a deprecated configuration option.
 void setUseReplQueue(boolean useReplQueue)
           
 void setUsingMultiplexer(boolean usingMultiplexer)
           
 void setWriteSkewCheck(boolean writeSkewCheck)
           
 
Methods inherited from class org.jboss.cache.config.ConfigurationComponent
addChildConfig, addChildConfigs, passCacheToChildConfig, removeChildConfig, removeChildConfigs, replaceChildConfig, replaceChildConfigs, setCache, testImmutability
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REPLICATION_VERSION

public static final short DEFAULT_REPLICATION_VERSION
Default replication version, from Version.getVersionShort().

Constructor Detail

Configuration

public Configuration()
Method Detail

legacyModeToCacheMode

public static Configuration.CacheMode legacyModeToCacheMode(int legacyMode)

setCacheMarshaller

public void setCacheMarshaller(Marshaller instance)

getMarshaller

public Marshaller getMarshaller()

isWriteSkewCheck

public boolean isWriteSkewCheck()

setWriteSkewCheck

public void setWriteSkewCheck(boolean writeSkewCheck)

getConcurrencyLevel

public int getConcurrencyLevel()

setConcurrencyLevel

public void setConcurrencyLevel(int concurrencyLevel)

setClusterConfig

public void setClusterConfig(Element config)
Converts a list of elements to a Java Groups property string.


setClusterName

public void setClusterName(String clusterName)

setClusterConfig

public void setClusterConfig(String clusterConfig)

setReplQueueMaxElements

public void setReplQueueMaxElements(int replQueueMaxElements)

setReplQueueInterval

public void setReplQueueInterval(long replQueueInterval)

setExposeManagementStatistics

public void setExposeManagementStatistics(boolean useMbean)

setInvocationBatchingEnabled

public void setInvocationBatchingEnabled(boolean enabled)
Enables invocation batching if set to true. You still need to use Cache.startBatch() and Cache.endBatch(boolean) to demarcate the start and end of batches.

Parameters:
enabled - if true, batching is enabled.
Since:
3.0

setFetchInMemoryState

public void setFetchInMemoryState(boolean fetchInMemoryState)

setReplicationVersion

public void setReplicationVersion(short replicationVersion)

setReplVersionString

public void setReplVersionString(String replVersionString)

setLockAcquisitionTimeout

public void setLockAcquisitionTimeout(long lockAcquisitionTimeout)

setSyncReplTimeout

public void setSyncReplTimeout(long syncReplTimeout)

setCacheMode

public void setCacheMode(Configuration.CacheMode cacheModeInt)

setCacheMode

public void setCacheMode(String cacheMode)

getCacheModeString

public String getCacheModeString()

setCacheModeString

public void setCacheModeString(String cacheMode)

setInactiveOnStartup

public void setInactiveOnStartup(boolean inactiveOnStartup)

getEvictionConfig

public EvictionConfig getEvictionConfig()

setEvictionConfig

public void setEvictionConfig(EvictionConfig config)

setUseRegionBasedMarshalling

public void setUseRegionBasedMarshalling(boolean useRegionBasedMarshalling)
This is a deprecated configuration option. While it will be supported for the 2.x series for backward compatibility, expect to see it disappear in 3.x.

With isUseLazyDeserialization(), which is enabled by default, custom class loaders are handled implicitly. See the user guide for details on how this is handled.


setTransactionManagerLookupClass

public void setTransactionManagerLookupClass(String transactionManagerLookupClass)

setCacheLoaderConfig

public void setCacheLoaderConfig(CacheLoaderConfig config)

setSyncCommitPhase

public void setSyncCommitPhase(boolean syncCommitPhase)

setSyncRollbackPhase

public void setSyncRollbackPhase(boolean syncRollbackPhase)

setListenerAsyncPoolSize

public void setListenerAsyncPoolSize(int listenerAsyncPoolSize)
Sets the size of the asynchronous listener notification thread pool size. Defaults to 1, and if set to below 1, all async listeners (specified with CacheListener.sync() are notified synchronously.

Parameters:
listenerAsyncPoolSize - number of threads in pool
Since:
3.0

setListenerAsyncQueueSize

public void setListenerAsyncQueueSize(int listenerAsyncQueueSize)
Sets the queue size of the bounded queue used to store async listener events on. This defaults to 50,000.

Parameters:
listenerAsyncQueueSize - queue size to use

setSerializationExecutorQueueSize

public void setSerializationExecutorQueueSize(int serializationExecutorQueueSize)
Sets the queue size of the bounded queue used to store async serialization events on. This defaults to 50,000.

Parameters:
serializationExecutorQueueSize - queue size to use

setBuddyReplicationConfig

public void setBuddyReplicationConfig(BuddyReplicationConfig config)

setNodeLockingScheme

@Deprecated
public void setNodeLockingScheme(Configuration.NodeLockingScheme nodeLockingScheme)
Deprecated. will default to MVCC once optimistic and pessimistic schemes are removed.

Parameters:
nodeLockingScheme -

setUseReplQueue

public void setUseReplQueue(boolean useReplQueue)

setIsolationLevel

public void setIsolationLevel(IsolationLevel isolationLevel)

setNodeLockingOptimistic

@Deprecated
public void setNodeLockingOptimistic(boolean nodeLockingOptimistic)
Deprecated. 

Starting with 3.x there are 3 locking schemes, so if true is passed in then state is not defined. It is here for backward compatibility reasons only and should not be used by new code.


setStateRetrievalTimeout

public void setStateRetrievalTimeout(long stateRetrievalTimeout)

setNodeLockingScheme

public void setNodeLockingScheme(String nodeLockingScheme)

getNodeLockingSchemeString

public String getNodeLockingSchemeString()

setNodeLockingSchemeString

public void setNodeLockingSchemeString(String nodeLockingScheme)

setIsolationLevel

public void setIsolationLevel(String isolationLevel)

getIsolationLevelString

public String getIsolationLevelString()

setIsolationLevelString

public void setIsolationLevelString(String isolationLevel)

setLockParentForChildInsertRemove

public void setLockParentForChildInsertRemove(boolean lockParentForChildInsertRemove)
Sets whether inserting or removing a node requires a write lock on the node's parent (when pessimistic locking is used.)

The default value is false


setMultiplexerStack

public void setMultiplexerStack(String stackName)

isUsingMultiplexer

public boolean isUsingMultiplexer()

setUsingMultiplexer

public void setUsingMultiplexer(boolean usingMultiplexer)

setShutdownHookBehavior

public void setShutdownHookBehavior(Configuration.ShutdownHookBehavior shutdownHookBehavior)

setShutdownHookBehavior

public void setShutdownHookBehavior(String shutdownHookBehavior)

setUseLazyDeserialization

public void setUseLazyDeserialization(boolean useLazyDeserialization)

setObjectInputStreamPoolSize

public void setObjectInputStreamPoolSize(int objectInputStreamPoolSize)
Initialises the size of the object input stream pool size, which defaults to 50.

Parameters:
objectInputStreamPoolSize -
Since:
2.1.0

setObjectOutputStreamPoolSize

public void setObjectOutputStreamPoolSize(int objectOutputStreamPoolSize)
Initialises the size of the object output stream pool size, which defaults to 50.

Parameters:
objectOutputStreamPoolSize -
Since:
2.1.0

setSerializationExecutorPoolSize

public void setSerializationExecutorPoolSize(int serializationExecutorPoolSize)
Sets the async replication serialization executor pool size for async replication. Has no effect if the replication queue is used.

Parameters:
serializationExecutorPoolSize - number of threads to use

getShutdownHookBehavior

public Configuration.ShutdownHookBehavior getShutdownHookBehavior()

isNodeLockingOptimistic

@Deprecated
public boolean isNodeLockingOptimistic()
Deprecated. use getNodeLockingScheme() to determine node locking scheme used.

This helper method is deprecated and will be removed when optimistic and pessimistic locking support is dropped.

Returns:
true if node locking scheme is optimistic.

isUseReplQueue

public boolean isUseReplQueue()

getClusterName

public String getClusterName()

getClusterConfig

public String getClusterConfig()

getReplQueueMaxElements

public int getReplQueueMaxElements()

getReplQueueInterval

public long getReplQueueInterval()

getExposeManagementStatistics

@Deprecated
public boolean getExposeManagementStatistics()
Deprecated. use isExposeManagementStatistics()


isExposeManagementStatistics

public boolean isExposeManagementStatistics()

isInvocationBatchingEnabled

public boolean isInvocationBatchingEnabled()
Returns:
true if invocation batching is enabled.
Since:
3.0

isFetchInMemoryState

public boolean isFetchInMemoryState()

getReplicationVersion

public short getReplicationVersion()

getReplVersionString

public String getReplVersionString()

getLockAcquisitionTimeout

public long getLockAcquisitionTimeout()

getSyncReplTimeout

public long getSyncReplTimeout()

getCacheMode

public Configuration.CacheMode getCacheMode()

isInactiveOnStartup

public boolean isInactiveOnStartup()

getIsolationLevel

public IsolationLevel getIsolationLevel()

isLockParentForChildInsertRemove

public boolean isLockParentForChildInsertRemove()
Gets whether inserting or removing a node requires a write lock on the node's parent (when pessimistic locking is used.)

The default value is false


isUseRegionBasedMarshalling

public boolean isUseRegionBasedMarshalling()

getTransactionManagerLookupClass

public String getTransactionManagerLookupClass()

getCacheLoaderConfig

public CacheLoaderConfig getCacheLoaderConfig()

isSyncCommitPhase

public boolean isSyncCommitPhase()

isSyncRollbackPhase

public boolean isSyncRollbackPhase()

getListenerAsyncPoolSize

public int getListenerAsyncPoolSize()
Gets the size of the asynchronous listener notification thread pool size. Defaults to 1, and if set to below 1, all async listeners (specified with CacheListener.sync() are notified synchronously.

Returns:
thread pool size
Since:
3.0

getBuddyReplicationConfig

public BuddyReplicationConfig getBuddyReplicationConfig()

getNodeLockingScheme

@Deprecated
public Configuration.NodeLockingScheme getNodeLockingScheme()
Deprecated. will be removed once optimistic and pessimistic locking is removed.

Returns:
node locking scheme in use

getStateRetrievalTimeout

public long getStateRetrievalTimeout()

getMultiplexerStack

public String getMultiplexerStack()

isUseLazyDeserialization

public boolean isUseLazyDeserialization()

getRuntimeConfig

public RuntimeConfig getRuntimeConfig()

setRuntimeConfig

public void setRuntimeConfig(RuntimeConfig runtimeConfig)

getMarshallerClass

public String getMarshallerClass()

setMarshallerClass

public void setMarshallerClass(String marshallerClass)

getObjectInputStreamPoolSize

public int getObjectInputStreamPoolSize()
Returns:
the size of he object input stream pool
Since:
2.1.0

getObjectOutputStreamPoolSize

public int getObjectOutputStreamPoolSize()
Returns:
the size of he object output stream pool
Since:
2.1.0

getDefaultClusterConfig

public URL getDefaultClusterConfig()
Returns a URL to a default JGroups configuration file.

Returns:
a default JGroups config file

getJGroupsConfigFile

public URL getJGroupsConfigFile()

setJgroupsConfigFile

public void setJgroupsConfigFile(URL jgroupsConfigFile)

getSerializationExecutorPoolSize

public int getSerializationExecutorPoolSize()
Returns:
the serialization executor pool size.

getListenerAsyncQueueSize

public int getListenerAsyncQueueSize()
Returns:
the bounded queue size for async listeners

getSerializationExecutorQueueSize

public int getSerializationExecutorQueueSize()
Returns:
the bounded queue size for async serializers

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public Configuration clone()
                    throws CloneNotSupportedException
Specified by:
clone in interface CloneableConfigurationComponent
Overrides:
clone in class ConfigurationComponent
Throws:
CloneNotSupportedException

isUsingCacheLoaders

public boolean isUsingCacheLoaders()

isUsingBuddyReplication

public boolean isUsingBuddyReplication()

getMuxStackName

public String getMuxStackName()

setMuxStackName

public void setMuxStackName(String muxStackName)

getCustomInterceptors

public List<CustomInterceptorConfig> getCustomInterceptors()
Returns the CustomInterceptorConfig, if any, associated with this configuration object. The custom interceptors will be added to the cache at startup in the sequence defined by this list.

Returns:
List of cutom interceptors, never null

setCustomInterceptors

public void setCustomInterceptors(List<CustomInterceptorConfig> customInterceptors)
See Also:
getCustomInterceptors()

getConsistentHashing

public BuddyManager getConsistentHashing()

isNonBlockingStateTransfer

public boolean isNonBlockingStateTransfer()

setNonBlockingStateTransfer

public void setNonBlockingStateTransfer(boolean nonBlockingStateTransfer)


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.