[jboss-cvs] JBossAS SVN: r93164 - projects/docs/community/5/Clustering_Guide/en-US.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 3 10:06:44 EDT 2009


Author: pferraro
Date: 2009-09-03 10:06:44 -0400 (Thu, 03 Sep 2009)
New Revision: 93164

Modified:
   projects/docs/community/5/Clustering_Guide/en-US/Clustering_Guide_Entity_EJBs.xml
Log:
Convert mbean configs to MC configs

Modified: projects/docs/community/5/Clustering_Guide/en-US/Clustering_Guide_Entity_EJBs.xml
===================================================================
--- projects/docs/community/5/Clustering_Guide/en-US/Clustering_Guide_Entity_EJBs.xml	2009-09-03 13:51:41 UTC (rev 93163)
+++ projects/docs/community/5/Clustering_Guide/en-US/Clustering_Guide_Entity_EJBs.xml	2009-09-03 14:06:44 UTC (rev 93164)
@@ -157,6 +157,7 @@
             <para>
               A multiplexed region factory uses separate Cache instances, using optimized configurations for each cache region.
             </para>
+            <para>
             <table border="1">
               <caption>Common properties for multiplexed region factory implementations</caption>
               <tr>
@@ -199,6 +200,7 @@
                 </td>
               </tr>
             </table>
+            </para>
             <para>Hibernate ships with 2 shared region factory implementations:</para>
             <variablelist>
               <varlistentry>
@@ -207,6 +209,7 @@
                   <para>
                     Uses separate JBoss Cache configurations, from a newly instantiated CacheManager, per cache region.
                   </para>
+                  <para>
                   <table border="1">
                     <caption>Additional properties for MultiplexedJBossCacheRegionFactory</caption>
                     <tr>
@@ -225,6 +228,7 @@
                       <td>The classpath or filesystem resource containing the JGroups protocol stack configurations.</td>
                     </tr>
                   </table>
+                  </para>
                 </listitem>
               </varlistentry>
               <varlistentry>
@@ -261,11 +265,7 @@
     </section>
     <section id="clustering-entity-30-bean">
       <title>Configure the entity beans for cache</title>
-<!-- 
-***************************
-This section is in progress
-***************************
--->
+      
       <para>
         Next we need to configure which entities to cache.
         The default is to not cache anything, even with the settings shown above.
@@ -283,7 +283,7 @@
         A very simplified rule of thumb is that you will typically want to do caching for objects that rarely change, and which are frequently read. 
         You can fine tune the cache for each entity bean in the appropriate JBoss Cache configuration file, e.g. jboss-cache-manager-jboss-beans.xml.
         For instance, you can specify the size of the cache.
-        If there are too many objects in the cache, the cache could evict oldest objects (or least used objects, depending on configuration) to make room for new objects.
+        If there are too many objects in the cache, the cache can evict the oldest or least used objects, depending on configuration, to make room for new objects.
         Assuming the region_prefix specified in <literal>persistence.xml</literal> was <literal>myprefix</literal>, the default name of the cache region for the <literal>com.mycompany.entities.Account</literal> entity bean would be <literal>/myprefix/com/mycompany/entities/Account</literal>.
       </para>
       <programlisting><![CDATA[
@@ -312,7 +312,7 @@
       <property name="evictionRegionConfigs">
         <list>
           <bean class="org.jboss.cache.config.EvictionRegionConfig">
-            <property name="regionName">/com/mycompany/entities/Account</property>
+            <property name="regionName">/myprefix/com/mycompany/entities/Account</property>
             <property name="evictionAlgorithmConfig">
               <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
                 <property name="maxNodes">10000</property>
@@ -329,7 +329,8 @@
 </bean>
 ]]></programlisting>
       <para>
-        If you do not specify a cache region for an entity bean class, all instances of this class will be cached in the <literal>/_default</literal> region as defined above. The @Cache annotation exposes an optional attribute “region” that lets you specify the cache region where an entity is to be stored, rather than having it be automatically be created from the fully-qualified class name of the entity class.
+        If you do not specify a cache region for an entity bean class, all instances of this class will be cached using the <literal>defaultEvictionRegionConfig</literal> as defined above.
+        The @Cache annotation exposes an optional attribute “region” that lets you specify the cache region where an entity is to be stored, rather than having it be automatically be created from the fully-qualified class name of the entity class.
       </para>
       <programlisting><![CDATA[
 @Entity 
@@ -342,39 +343,51 @@
       <para>
         The eviction configuration would then become:
       </para>
-      <programlisting><![CDATA[      
-<server>
-  <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=EJB3EntityTreeCache">
-     ... ...
-    <attribute name="EvictionPolicyConfig">
-      <config>
-        <attribute name="wakeUpIntervalSeconds">5</attribute>
-        <region name="/_default_">
-          <attribute name="maxNodes">5000</attribute>
-          <attribute name="timeToLiveSeconds">1000</attribute>
-        </region>
-        <!-- Separate eviction rules for Account entities -->
-        <region name="/myprefix/Account">
-          <attribute name="maxNodes">10000</attribute>
-          <attribute name="timeToLiveSeconds">5000</attribute>
-        </region>
-         ... ...
-      </config>
-    </attribute>
-  </mbean>
-</server>
+      <programlisting><![CDATA[
+<bean name="..." class="org.jboss.cache.config.Configuration">
+   ... ...
+  <property name="evictionConfig">
+    <bean class="org.jboss.cache.config.EvictionConfig">
+      <property name="wakeupInterval">5000</property>
+      <!--  Overall default -->
+      <property name="defaultEvictionRegionConfig">
+        <bean class="org.jboss.cache.config.EvictionRegionConfig">
+          <property name="regionName">/</property>
+          <property name="evictionAlgorithmConfig">
+            <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+              <property name="maxNodes">5000</property>
+              <property name="timeToLiveSeconds">1000</property>
+              <property name="minTimeToLiveSeconds">120</property>
+            </bean>
+          </property>
+        </bean>
+      </property>
+      <property name="evictionRegionConfigs">
+        <list>
+          <bean class="org.jboss.cache.config.EvictionRegionConfig">
+            <property name="regionName">/myprefix/Account</property>
+            <property name="evictionAlgorithmConfig">
+              <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+                <property name="maxNodes">10000</property>
+                <property name="timeToLiveSeconds">5000</property>
+                <property name="minTimeToLiveSeconds">120</property>
+              </bean>
+            </property>
+          </bean>
+           ... ...
+        </list>
+      </property>
+    </bean>
+  </property>
+</bean>
 ]]></programlisting>
     </section>
 
     <section>
       <title>Query result caching</title>
-<!-- 
-***************************
-This section is in progress
-***************************
--->
       <para>  
-        The EJB3 Query API also provides means for you to save in the second-level cache the  results (i.e., collections of primary keys of entity beans, or collections of scalar values) of specified queries.   Here we show a simple example of annotating a bean with a named query, also providing the Hibernate-specific hints that tells Hibernate to cache the query.
+        The EJB3 Query API also provides means for you to save the results (i.e., collections of primary keys of entity beans, or collections of scalar values) of specified queries in the second-level cache.
+        Here we show a simple example of annotating a bean with a named query, also providing the Hibernate-specific hints that tells Hibernate to cache the query.
       </para>
       <para>
         First, in persistence.xml you need to tell Hibernate to enable query caching:
@@ -404,34 +417,56 @@
         See the Hibernate and EJB3 documentation for more on how to use EJB3 queries and on how to instruct EJB3 to cache queries. 
       </para>
       <para>
-        By default, Hibernate stores query results in JBoss Cache in a region named {region_prefix}/org/hibernate/cache/StandardQueryCache. Based on this, you can set up separate eviction handling for your query results. So, if the region prefix were set to myprefix in persistence.xml, you could, for example, create this sort of eviction handling:
+        By default, Hibernate stores query results in JBoss Cache in a region named {region_prefix}/org/hibernate/cache/StandardQueryCache.
+        Based on this, you can set up separate eviction handling for your query results.
+        So, if the region prefix were set to myprefix in persistence.xml, you could, for example, create this sort of eviction handling:
       </para>
-      <programlisting><![CDATA[ 
-<server>  
-  <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=EJB3EntityTreeCache">
-     ... ... 
-    <attribute name="EvictionPolicyConfig">  
-      <config>  
-        <attribute name="wakeUpIntervalSeconds">5</attribute>  
-        <region name="/_default_">  
-          <attribute name="maxNodes">5000</attribute>  
-          <attribute name="timeToLiveSeconds">1000</attribute>  
-        </region>  
-        <!-- Separate eviction rules for Account entities -->
-        <region name="/myprefix/Account">  
-          <attribute name="maxNodes">10000</attribute>  
-          <attribute name="timeToLiveSeconds">5000</attribute>  
-        </region>
-        <!-- Cache queries for 10 minutes -->
-        <region name="/myprefix/org/hibernate/cache/StandardQueryCache">  
-          <attribute name="maxNodes">100</attribute>  
-          <attribute name="timeToLiveSeconds">600</attribute>  
-        </region>  
-         ... ... 
-      </config>  
-    </attribute>  
-  </mbean> 
-</server>
+      <programlisting><![CDATA[
+<bean name="..." class="org.jboss.cache.config.Configuration">
+    ... ...
+   <property name="evictionConfig">
+       <bean class="org.jboss.cache.config.EvictionConfig">
+         <property name="wakeupInterval">5000</property>
+         <!--  Overall default -->
+         <property name="defaultEvictionRegionConfig">
+            <bean class="org.jboss.cache.config.EvictionRegionConfig">
+               <property name="regionName">/</property>
+               <property name="evictionAlgorithmConfig">
+                  <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+                     <property name="maxNodes">5000</property>
+                     <property name="timeToLiveSeconds">1000</property>
+                     <property name="minTimeToLiveSeconds">120</property>
+                  </bean>
+               </property>
+            </bean>
+         </property>
+         <property name="evictionRegionConfigs">
+            <list>
+               <bean class="org.jboss.cache.config.EvictionRegionConfig">
+                  <property name="regionName">/myprefix/Account</property>
+                  <property name="evictionAlgorithmConfig">
+                     <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+                        <property name="maxNodes">10000</property>
+                        <property name="timeToLiveSeconds">5000</property>
+                        <property name="minTimeToLiveSeconds">120</property>
+                     </bean>
+                  </property>
+               </bean>
+               <bean class="org.jboss.cache.config.EvictionRegionConfig">
+                  <property name="regionName">/myprefix/org/hibernate/cache/StandardQueryCache</property>
+                  <property name="evictionAlgorithmConfig">
+                     <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+                        <property name="maxNodes">100</property>
+                        <property name="timeToLiveSeconds">600</property>
+                        <property name="minTimeToLiveSeconds">120</property>
+                     </bean>
+                  </property>
+               </bean>
+            </list>
+         </property>
+      </bean>
+   </property>
+</bean>
 ]]></programlisting>
       <para>
         The @NamedQuery.hints attribute shown above takes an array of vendor-specific @QueryHints as a value. Hibernate accepts the “org.hibernate.cacheRegion” query hint, where the value is the name of a cache region to use instead ofthe default /org/hibernate/cache/StandardQueryCache. For example:
@@ -459,32 +494,53 @@
       <para>
         The related eviction configuration:
       </para>
-      <programlisting><![CDATA[  
-<server>
-  <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=EJB3EntityTreeCache">
-     ... ...
-    <attribute name="EvictionPolicyConfig">
-      <config>
-        <attribute name="wakeUpIntervalSeconds">5</attribute>
-        <region name="/_default_">
-          <attribute name="maxNodes">5000</attribute>
-          <attribute name="timeToLiveSeconds">1000</attribute>
-        </region>
-        <!-- Separate eviction rules for Account entities -->
-        <region name="/myprefix/Account">
-          <attribute name="maxNodes">10000</attribute>
-          <attribute name="timeToLiveSeconds">5000</attribute>
-        </region>
-        <!-- Cache queries for 10 minutes -->
-        <region name="/myprefix/Queries">
-          <attribute name="maxNodes">100</attribute>
-          <attribute name="timeToLiveSeconds">600</attribute>
-        </region>
-         ... ...
-      </config>
-    </attribute>
-  </mbean>
-</server>
+      <programlisting><![CDATA[
+<bean name="..." class="org.jboss.cache.config.Configuration">
+    ... ...
+   <property name="evictionConfig">
+       <bean class="org.jboss.cache.config.EvictionConfig">
+         <property name="wakeupInterval">5000</property>
+         <!--  Overall default -->
+         <property name="defaultEvictionRegionConfig">
+            <bean class="org.jboss.cache.config.EvictionRegionConfig">
+               <property name="regionName">/</property>
+               <property name="evictionAlgorithmConfig">
+                  <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+                     <property name="maxNodes">5000</property>
+                     <property name="timeToLiveSeconds">1000</property>
+                     <property name="minTimeToLiveSeconds">120</property>
+                  </bean>
+               </property>
+            </bean>
+         </property>
+         <property name="evictionRegionConfigs">
+            <list>
+               <bean class="org.jboss.cache.config.EvictionRegionConfig">
+                  <property name="regionName">/myprefix/Account</property>
+                  <property name="evictionAlgorithmConfig">
+                     <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+                        <property name="maxNodes">10000</property>
+                        <property name="timeToLiveSeconds">5000</property>
+                        <property name="minTimeToLiveSeconds">120</property>
+                     </bean>
+                  </property>
+               </bean>
+               <bean class="org.jboss.cache.config.EvictionRegionConfig">
+                  <property name="regionName">/myprefix/Queries</property>
+                  <property name="evictionAlgorithmConfig">
+                     <bean class="org.jboss.cache.eviction.LRUAlgorithmConfig">
+                        <property name="maxNodes">100</property>
+                        <property name="timeToLiveSeconds">600</property>
+                        <property name="minTimeToLiveSeconds">120</property>
+                     </bean>
+                  </property>
+               </bean>
+                ... ...
+            </list>
+         </property>
+      </bean>
+   </property>
+</bean>
 ]]></programlisting>
     </section>
   </section>




More information about the jboss-cvs-commits mailing list