alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (infinispan-configs.xml)

This example Hibernate source code file (infinispan-configs.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

a, a, default, eviction, eviction, lru, lru, note, read_committed, repeatable_read, state, todo, wakeupinterval, wakeupinterval

The Hibernate infinispan-configs.xml source code

<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:4.0">
   <global>
      <transport transportClass = "org.infinispan.remoting.transport.jgroups.JGroupsTransport" 
            clusterName="infinispan-hibernate-cluster" distributedSyncTimeout="50000">
         <!-- Note that the JGroups transport uses sensible defaults if no configuration property is defined. -->
         <properties>
            <!-- TODO: Change to udp.xml once streaming transfer requirement has been removed.  -->
            <property name="configurationFile" value="flush-udp.xml"/>
         </properties>
         <!-- See the JGroupsTransport javadocs for more flags -->
      </transport>
   </global>

   <default>
      <!-- Used to register JMX statistics in any available MBean server -->
      <jmxStatistics enabled="false"/>
   </default>

   <!-- Default configuration is appropriate for entity/collection caching. -->
   <namedCache name="entity">
      <clustering mode="invalidation">
         <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
         <sync replTimeout="20000"/>
      </clustering>
      <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000"
               lockAcquisitionTimeout="15000" useLockStriping="false" />
      <!-- Eviction configuration.  WakeupInterval defines how often the eviction thread runs, in milliseconds.  
           0 means the eviction thread will never run.  A separate executor is used for eviction in each cache. -->
      <eviction wakeUpInterval="5000" maxEntries="10000" strategy="LRU"/>
      <expiration maxIdle="100000"/>
      <lazyDeserialization enabled="true"/>
   </namedCache>
   
   <!-- Default configuration is appropriate for entity/collection caching. -->
   <namedCache name="entity-repeatable">
      <clustering mode="invalidation">
         <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
         <sync replTimeout="20000"/>
      </clustering>
      <!-- Note: REPEATABLE_READ is only useful if the application evicts/clears entities 
        from the Hibernate Session and then expects to repeatably re-read them in 
        the same transaction. Otherwise, the Session's internal cache provides a 
        repeatable-read semantic. Before choosing this config, carefully read the docs
        and make sure you really need REPEATABLE_READ.
       -->
      <locking isolationLevel="REPEATABLE_READ" concurrencyLevel="1000"
               lockAcquisitionTimeout="15000" useLockStriping="false"/>
      <!-- Eviction configuration.  WakeupInterval defines how often the eviction thread runs, in milliseconds.  
           0 means the eviction thread will never run.  A separate executor is used for eviction in each cache. -->
      <eviction wakeUpInterval="5000" maxEntries="10000" strategy="LRU"/>
      <expiration maxIdle="100000"/>
      <lazyDeserialization enabled="true"/>
   </namedCache>
   
   <!-- An alternative configuration for entity/collection caching that uses replication instead of invalidation -->
   <namedCache name="replicated-entity">
      <clustering mode="replication">
         <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
         <sync replTimeout="20000"/>
      </clustering>
      <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000"
               lockAcquisitionTimeout="15000" useLockStriping="false"/>
      <!-- Eviction configuration.  WakeupInterval defines how often the eviction thread runs, in milliseconds.  
           0 means the eviction thread will never run.  A separate executor is used for eviction in each cache. -->
      <eviction wakeUpInterval="5000" maxEntries="10000" strategy="LRU"/>
      <expiration maxIdle="100000"/>
      <lazyDeserialization enabled="true"/>
   </namedCache>
   
   
   <!-- A config appropriate for query caching. Does not replicate queries. -->
   <namedCache name="local-query">
      <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000"
               lockAcquisitionTimeout="15000" useLockStriping="false"/>
      <!--Eviction configuration.  WakeupInterval defines how often the eviction thread runs, in milliseconds.  0 means
         the eviction thread will never run.  A separate executor is used for eviction in each cache. -->
      <eviction wakeUpInterval="5000" maxEntries="10000" strategy="LRU"/>
      <expiration maxIdle="100000"/>
   </namedCache>

   <!-- A query cache that replicates queries. Replication is asynchronous. -->
   <namedCache name="replicated-query">
      <clustering mode="replication">
         <async/>
      </clustering>
      <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000"
               lockAcquisitionTimeout="15000" useLockStriping="false"/>
      <!--Eviction configuration.  WakeupInterval defines how often the eviction thread runs, in milliseconds.  0 means
         the eviction thread will never run.  A separate executor is used for eviction in each cache. -->
      <eviction wakeUpInterval="5000" maxEntries="10000" strategy="LRU"/>
      <expiration maxIdle="100000"/>
      <!-- State transfer forces all replication calls to be synchronous,
           so for calls to remain async, use a cluster cache loader instead -->
      <loaders passivation="false" shared="false" preload="false">
         <loader class="org.infinispan.loaders.cluster.ClusterCacheLoader" fetchPersistentState="false"
                 ignoreModifications="false" purgeOnStartup="false">
            <properties>
               <property name="remoteCallTimeout" value="20000"/>
            </properties>
         </loader>
      </loaders>
   </namedCache>

   <!-- Optimized for timestamp caching. A clustered timestamp cache
        is required if query caching is used, even if the query cache
        itself is configured with CacheMode=LOCAL. -->
   <namedCache name="timestamps">
      <clustering mode="replication">
         <async/>
      </clustering>
      <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000"
               lockAcquisitionTimeout="15000" useLockStriping="false"/>
      <lazyDeserialization enabled="true"/>
      <!--  Don't ever evict modification timestamps -->
      <eviction wakeUpInterval="0" strategy="NONE"/>
      <!-- State transfer forces all replication calls to be synchronous,
           so for calls to remain async, use a cluster cache loader instead -->
      <loaders passivation="false" shared="false" preload="false">
         <loader class="org.infinispan.loaders.cluster.ClusterCacheLoader" fetchPersistentState="false"
                 ignoreModifications="false" purgeOnStartup="false">
            <properties>
               <property name="remoteCallTimeout" value="20000"/>
            </properties>
         </loader>
      </loaders>
   </namedCache>

</infinispan>

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate infinispan-configs.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.