<?xml version="1.0" encoding="UTF-8"?>

<deployment xmlns="urn:jboss:bean-deployer:2.0">

   <!-- First we create a Configuration object for the cache -->
   <bean name="EJB3EntityCacheConfig"
   		 class="org.jboss.cache.config.Configuration">
      
      <!-- Externally injected services -->  
      <property name="runtimeConfig">
         <bean name="EJB3EntityCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
            <property name="transactionManager"><inject bean="jboss:service=TransactionManager" property="TransactionManager"/></property>
            <property name="muxChannelFactory"><inject bean="jgroups.mux:name=Multiplexer"/></property>
         </bean>
      </property>
      
      <property name="multiplexerStack">${jboss.multiplexer.stack:udp}</property>

      <property name="clusterName">${jboss.partition.name:DefaultPartition}-EntityCache</property>
        
      <!--
              Node locking level : SERIALIZABLE
                                   REPEATABLE_READ (default)
                                   READ_COMMITTED
                                   READ_UNCOMMITTED
                                   NONE
      -->
      <property name="isolationLevelString">REPEATABLE_READ</property>

      <!--     Valid modes are LOCAL
                               REPL_ASYNC
                               REPL_SYNC
      -->
      <property name="cacheModeString">REPL_SYNC</property>

      <!--  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
      -->
      <property name="initialStateRetrievalTimeout">15000</property>

      <!--    Number of milliseconds to wait until all responses for a
              synchronous call have been received.
      -->
      <property name="syncReplTimeout">20000</property>

      <!--  Max number of milliseconds to wait for a lock acquisition -->
      <property name="lockAcquisitionTimeout">15000</property>
        
      <property name="exposeManagementStatistics">true</property>
      
      <!-- Must be true if any entity deployment uses a scoped classloader -->
      <property name="useRegionBasedMarshalling">true</property>
      <!-- Must match the value of "useRegionBasedMarshalling" -->
      <property name="inactiveOnStartup">true</property>

      <!--  Specific eviction policy configurations. This is LRU -->
      <property name="evictionConfig">
      	 <bean name="EJB3EntityEvictionConfig" class="org.jboss.cache.config.EvictionConfig">
      	    <property name="defaultEvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</property>
            <property name="wakeupIntervalSeconds">5</property>
            <property name="evictionRegionConfigs">
            	<list>
            		<!-- Default region will never timeout -->
            		<bean name="EJB3EntityDefaultEvictionRegionConfig" class="org.jboss.cache.config.EvictionRegionConfig">
            			<property name="regionName">/_default_</property>
            			<property name="evictionPolicyConfig">
            				<bean name="EJB3EntityDefaultLRUConfig" class="org.jboss.cache.eviction.LRUConfiguration">
               					<property name="maxNodes">5000</property>
               					<property name="timeToLiveSeconds">1000</property>
               				</bean>
               			</property>
            		</bean>
            		<!-- EJB3 integration code will programatically create other
            		     regions as beans are deployed -->
            	</list>
			</property>
         </bean>
      </property>
      
   </bean>
    
   <!-- Now we use the above configuration to construct the cache itself -->
   <bean name="EJB3EntityCache" class="org.jboss.cache.jmx.CacheJmxWrapper">
      
      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=EJB3EntityTreeCache", exposedInterface=org.jboss.cache.jmx.CacheJmxWrapperMBean.class, registerDirectly=true)</annotation>
      
      <property name="configuration"><inject bean="EJB3EntityCacheConfig"/></property>
          
   </bean>

</deployment>

