JBoss.org Community Documentation
This is what a typical XML configuration file looks like. It is recommended that you use one of the configurations shipped with the JBoss Cache distribution and tweak according to your needs rather than write one from scratch.
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- Sample JBoss Cache Service Configuration -->
<!-- -->
<!-- ===================================================================== -->
<server>
<!-- ==================================================================== -->
<!-- Defines JBoss Cache configuration -->
<!-- ==================================================================== -->
<!-- Note the value of the 'code' attribute has changed since JBC 1.x -->
<mbean code="org.jboss.cache.jmx.CacheJmxWrapper" name="jboss.cache:service=Cache">
<!-- Ensure JNDI and the TransactionManager are started before the
cache. Only works inside JBoss AS; ignored otherwise -->
<depends>jboss:service=Naming</depends>
<depends>jboss:service=TransactionManager</depends>
<!-- Configure the TransactionManager -->
<attribute name="TransactionManagerLookupClass">
org.jboss.cache.transaction.GenericTransactionManagerLookup
</attribute>
<!-- Node locking level : SERIALIZABLE
REPEATABLE_READ (default)
READ_COMMITTED
READ_UNCOMMITTED
NONE -->
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
<!-- Lock parent before doing node additions/removes -->
<attribute name="LockParentForChildInsertRemove">true</attribute>
<!-- Valid modes are LOCAL (default)
REPL_ASYNC
REPL_SYNC
INVALIDATION_ASYNC
INVALIDATION_SYNC -->
<attribute name="CacheMode">REPL_ASYNC</attribute>
<!-- Name of cluster. Needs to be the same for all JBoss Cache nodes in a
cluster in order to find each other.
-->
<attribute name="ClusterName">JBossCache-Cluster</attribute>
<!--Uncomment next three statements to use the JGroups multiplexer.
This configuration is dependent on the JGroups multiplexer being
registered in an MBean server such as JBossAS. This type of
dependency injection only works in the AS; outside it's up to
your code to inject a ChannelFactory if you want to use one.
-->
<!--
<depends optional-attribute-name="MultiplexerService"
proxy-type="attribute">jgroups.mux:name=Multiplexer</depends>
<attribute name="MultiplexerStack">tcp</attribute>
-->
<!-- JGroups protocol stack properties.
ClusterConfig isn't used if the multiplexer is enabled above.
-->
<attribute name="ClusterConfig">
<config>
<!-- UDP: if you have a multihomed machine, set the bind_addr
attribute to the appropriate NIC IP address -->
<!-- UDP: On Windows machines, because of the media sense feature
being broken with multicast (even after disabling media sense)
set the loopback attribute to true -->
<UDP mcast_addr="228.1.2.3" mcast_port="48866"
ip_ttl="64" ip_mcast="true"
mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
loopback="false"/>
<PING timeout="2000" num_initial_members="3"/>
<MERGE2 min_interval="10000" max_interval="20000"/>
<FD shun="true"/>
<FD_SOCK/>
<VERIFY_SUSPECT timeout="1500"/>
<pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800" />
<UNICAST timeout="600,1200,2400",4800/>
<pbcast.STABLE desired_avg_gossip="400000"/>
<FC max_credits="2000000" min_threshold="0.10"/>
<FRAG2 frag_size="8192"/>
<pbcast.GMS join_timeout="5000" shun="true" print_local_addr="true"/>
<pbcast.STATE_TRANSFER/>
</config>
</attribute>
<!--
The max amount of time (in milliseconds) we wait until the
initial state (ie. the contents of the cache) are retrieved from
existing members in a clustered environment
-->
<attribute name="StateRetrievalTimeout">20000</attribute>
<!--
Number of milliseconds to wait until all responses for a
synchronous call have been received.
-->
<attribute name="SyncReplTimeout">20000</attribute>
<!-- Max number of milliseconds to wait for a lock acquisition -->
<attribute name="LockAcquisitionTimeout">15000</attribute>
<!-- Shutdown hook behavior. Valid choices are: DEFAULT, REGISTER and DONT_REGISTER.
If this element is omitted, DEFAULT is used. -->
<attribute name="ShutdownHookBehavior">DEFAULT</attribute>
<!-- Enables or disables lazy unmarshalling. If omitted, the default is that lazy unmarshalling is enabled. -->
<attribute name="UseLazyDeserialization">true</attribute>
<!-- Specific eviction policy configurations. This is LRU -->
<attribute name="EvictionConfig">
<config>
<attribute name="wakeUpIntervalSeconds">5</attribute>
<!-- This defaults to 200000 if not specified -->
<attribute name="eventQueueSize">200000</attribute>
<attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
<!-- Cache wide default -->
<region name="/_default_">
<attribute name="maxNodes">5000</attribute>
<attribute name="timeToLiveSeconds">1000</attribute>
</region>
<region name="/org/jboss/data">
<attribute name="maxNodes">5000</attribute>
<attribute name="timeToLiveSeconds">1000</attribute>
</region>
<region name="/org/jboss/test/data">
<attribute name="maxNodes">5</attribute>
<attribute name="timeToLiveSeconds">4</attribute>
</region>
<region name="/test">
<attribute name="maxNodes">10000</attribute>
<attribute name="timeToLiveSeconds">4</attribute>
</region>
<region name="/maxAgeTest">
<attribute name="maxNodes">10000</attribute>
<attribute name="timeToLiveSeconds">8</attribute>
<attribute name="maxAgeSeconds">10</attribute>
</region>
</config>
</attribute>
</mbean>
</server>