<?xml version="1.0" encoding="UTF-8"?>
<infinispan
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:infinispan:config:4.0 http://www.infinispan.org/schemas/infinispan-config-4.0.xsd"
      xmlns="urn:infinispan:config:4.0">

   <!-- *************************** -->
   <!-- System-wide global settings -->
   <!-- *************************** -->

   <global>

      <!-- Note that if these are left blank, defaults are used.  See the user guide for what these defaults are -->
      <asyncListenerExecutor factory="org.infinispan.executors.DefaultExecutorFactory">
         <properties>
         	<property name="maxThreads" value="5"/>
         	<property name="threadNamePrefix" value="AsyncListenerThread"/>
         </properties>
      </asyncListenerExecutor>

      <asyncTransportExecutor factory="org.infinispan.executors.DefaultExecutorFactory">
         <properties>
         	<property name="maxThreads" value="25"/>
         	<property name="threadNamePrefix" value="AsyncSerializationThread"/>
         </properties>
      </asyncTransportExecutor>

      <evictionScheduledExecutor factory="org.infinispan.executors.DefaultScheduledExecutorFactory">
         <properties>
         	<property name="threadNamePrefix" value="EvictionThread"/>
         </properties>
      </evictionScheduledExecutor>

      <replicationQueueScheduledExecutor factory="org.infinispan.executors.DefaultScheduledExecutorFactory">
         <properties>
         	<property name="threadNamePrefix" value="ReplicationQueueThread"/>
         </properties>
      </replicationQueueScheduledExecutor>

      <globalJmxStatistics enabled="true" jmxDomain="infinispan"/>

      <!--
         If the transport is omitted, there is no way to create distributed or clustered caches.
         There is no added cost to defining a transport but not creating a cache that uses one, since the transport
         is created and initialized lazily.
      -->
      <transport clusterName="infinispan-cluster" distributedSyncTimeout="50000" nodeName="Jalapeno"/>
         <!-- Note that the JGroups transport uses sensible defaults if no configuration property is defined. -->
         <!-- See the JGroupsTransport javadocs for more flags -->

      <!-- Again, sensible defaults are used here if this is omitted.  -->
      <serialization marshallerClass="org.infinispan.marshall.VersionAwareMarshaller" version="1.0"/>

      <!--
         Used to register JVM shutdown hooks.
         hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
      -->
      <shutdown hookBehavior="DEFAULT"/>
   </global>

   <!-- *************************** -->
   <!-- Default "template" settings -->
   <!-- *************************** -->
   <!-- this is used as a "template" configuration for all caches in the system. -->
   <default>
      <!--
         isolation levels supported: READ_COMMITTED and REPEATABLE_READ
      -->
      <locking
            isolationLevel="REPEATABLE_READ"
            lockAcquisitionTimeout="20000"
            writeSkewCheck="false"
            concurrencyLevel="500"
            useLockStriping="true"
            />

      <!--
      Used to register a transaction manager and participate in ongoing transactions.
      -->
      <transaction
            transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
            syncRollbackPhase="false"
            syncCommitPhase="false"
            useEagerLocking="false"/>

      <!--
      Used to register JMX statistics in any available MBean server
      -->
      <jmxStatistics enabled="false"/>

      <lazyDeserialization enabled="false"/>

      <!--
         Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
      -->
      <invocationBatching enabled="false"/>

      <!--
         This element specifies that the cache is clustered.
         modes supported: distribution (d), replication (r) or invalidation (i).
      -->
      <clustering mode="replication">

         <!--
            Defines whether to retrieve state on startup
         -->
         <stateRetrieval timeout="20000" fetchInMemoryState="false"/>

         <!--
            Network calls are synchronous.
         -->
         <sync replTimeout="20000"/>
         <!--
            Uncomment this for async replication.
         -->
         <async useReplQueue="true" replQueueInterval="10000" replQueueMaxElements="500"/>
      </clustering>

   </default>

   <namedCache name="persistentCache">
      <loaders passivation="false" shared="false" preload="true">

         <!--
            We can have multiple cache loaders, which get chained
         -->
         <loader class="org.infinispan.loaders.jpa.JPACacheStore" >

            <!-- See the documentation for more configuration examples and flags. -->
            <properties>
               <property name="persistenceUnitName" value="ISPN"/>
               <property name="entityClassName" value="br.com.rar.ispn.sample.TestEntity"/>
            </properties>
         </loader>
      </loaders>

      <deadlockDetection enabled="true" spinDuration="1000"/>

   </namedCache>
</infinispan>
