[jboss-cvs] JBossAS SVN: r94130 - projects/docs/community/5/Clustering_Guide/en-US.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 29 18:27:30 EDT 2009
Author: bstansberry at jboss.com
Date: 2009-09-29 18:27:30 -0400 (Tue, 29 Sep 2009)
New Revision: 94130
Modified:
projects/docs/community/5/Clustering_Guide/en-US/Clustering_Guide_EJBs.xml
Log:
Make stuff fit on PDF
Modified: projects/docs/community/5/Clustering_Guide/en-US/Clustering_Guide_EJBs.xml
===================================================================
--- projects/docs/community/5/Clustering_Guide/en-US/Clustering_Guide_EJBs.xml 2009-09-29 22:17:48 UTC (rev 94129)
+++ projects/docs/community/5/Clustering_Guide/en-US/Clustering_Guide_EJBs.xml 2009-09-29 22:27:30 UTC (rev 94130)
@@ -21,13 +21,11 @@
To cluster a stateless session bean in EJB 3.0, simply annotate the bean class with the <literal>@Clustered</literal> annotation.
This annotation contains optional parameters for overriding both the load balance policy and partition to use.
</para>
-<programlisting id="clustered-annoation"><![CDATA[
-public @interface Clustered
+<programlisting id="clustered-annoation"><![CDATA[public @interface Clustered
{
String partition() default "${jboss.partition.name:DefaultPartition}";
String loadBalancePolicy() default "LoadBalancePolicy";
-}
-]]></programlisting>
+}]]></programlisting>
<itemizedlist>
<listitem>
<para>
@@ -74,8 +72,7 @@
</listitem>
</itemizedlist>
<para>Here is an example of a clustered EJB 3.0 stateless session bean implementation.</para>
-<programlisting><![CDATA[
- at Stateless
+<programlisting><![CDATA[@Stateless
@Clustered
public class MyBean implements MySessionInt
{
@@ -83,25 +80,24 @@
{
// Do something cool
}
-}
-]]></programlisting>
+}]]></programlisting>
<para>
Rather than using the <literal>@Clustered</literal> annotation, you can also enable clustering for a session bean in jboss.xml:
</para>
-<programlisting><![CDATA[
-<jboss>
+<programlisting><![CDATA[<jboss>
<enterprise-beans>
<session>
<ejb-name>NonAnnotationStateful</ejb-name>
<clustered>true</clustered>
<cluster-config>
<partition-name>FooPartition</partition-name>
- <load-balance-policy>org.jboss.ha.framework.interfaces.RandomRobin</load-balance-policy>
+ <load-balance-policy>
+ org.jboss.ha.framework.interfaces.RandomRobin
+ </load-balance-policy>
</cluster-config>
</session>
</enterprise-beans>
-</jboss>
-]]></programlisting>
+</jboss>]]></programlisting>
<note>
<para>
@@ -134,16 +130,14 @@
The <literal>@org.jboss.ejb3.annotation.CacheConfig</literal> annotation can also be applied to the bean to override the default caching behavior.
Below is the definition of the <literal>@CacheConfig</literal> annotation:
</para>
-<programlisting><![CDATA[
-public @interface CacheConfig
+<programlisting><![CDATA[public @interface CacheConfig
{
String name() default "";
int maxSize() default 10000;
long idleTimeoutSeconds() default 300;
boolean replicationIsPassivation() default true;
long removalTimeoutSeconds() default 0;
-}
-]]></programlisting>
+}]]></programlisting>
<itemizedlist>
<listitem><para><literal>name</literal> specifies the name of a cache configuration registered with the <literal>CacheManager</literal> service discussed in <xref linkend="sfsb-jbc-cachemanager"/>. By default, the <literal>sfsb-cache</literal> configuration will be used.</para></listitem>
@@ -154,8 +148,7 @@
</itemizedlist>
<para>Here is an example of a clustered EJB 3.0 stateful session bean implementation.</para>
-<programlisting><![CDATA[
- at Stateful
+<programlisting><![CDATA[@Stateful
@Clustered
@CacheConfig(maxSize=5000, removalTimeoutSeconds=18000)
public class MyBean implements MySessionInt
@@ -166,14 +159,12 @@
{
System.out.println("counter: " + (state++));
}
-}
-]]></programlisting>
+}]]></programlisting>
<para>
As with stateless beans, the @Clustered annotation can alternatively be omitted and the clustering configuration instead applied to jboss.xml:
</para>
-<programlisting><![CDATA[
-<jboss>
+<programlisting><![CDATA[<jboss>
<enterprise-beans>
<session>
<ejb-name>NonAnnotationStateful</ejb-name>
@@ -184,8 +175,7 @@
</cache-config>
</session>
</enterprise-beans>
-</jboss>
-]]></programlisting>
+</jboss>]]></programlisting>
</section>
<section>
@@ -194,12 +184,10 @@
As the replication process is a costly operation, you can optimise this behaviour by
optionally implementing the org.jboss.ejb3.cache.Optimized interface in your bean class:
</para>
-<programlisting><![CDATA[
-public interface Optimized
+<programlisting><![CDATA[public interface Optimized
{
boolean isModified();
-}
-]]></programlisting>
+}]]></programlisting>
<para>
Before replicating your bean, the container will check if your bean implements the <literal>Optimized</literal> interface.
If this is the case, the container calls the <literal>isModified()</literal> method and will only replicate the bean when the method returns <literal>true</literal>.
@@ -214,13 +202,14 @@
The <literal>CacheManager</literal> service, described in <xref linkend="clustering-blocks-jbc-cachemanager"/> is both a factory and registry of JBoss Cache instances.
By default, stateful session beans use the <literal>sfsb-cache</literal> configuration from the <literal>CacheManager</literal>, defined as follows:
</para>
-<programlisting><![CDATA[
-<bean name="StandardSFSBCacheConfig" class="org.jboss.cache.config.Configuration">
+<programlisting><![CDATA[<bean name="StandardSFSBCacheConfig" class="org.jboss.cache.config.Configuration">
<!-- No transaction manager lookup -->
<!-- Name of cluster. Needs to be the same for all members -->
- <property name="clusterName">${jboss.partition.name:DefaultPartition}-SFSBCache</property>
+ <property name="clusterName">
+ ${jboss.partition.name:DefaultPartition}-SFSBCache
+ </property>
<!--
Use a UDP (multicast) based stack. Need JGroups flow control (FC)
because we are using asynchronous replication.
@@ -332,8 +321,7 @@
<!-- EJB3 integration code will programatically create other regions as beans are deployed -->
</bean>
</property>
-</bean>
-]]></programlisting>
+</bean>]]></programlisting>
<simplesect>
<title>Eviction</title>
@@ -390,8 +378,7 @@
To make an EJB 2.x bean clustered, you need to modify its <literal>jboss.xml</literal>
descriptor to contain a <literal><clustered></literal> tag.
</para>
-<programlisting><![CDATA[
-<jboss>
+<programlisting><![CDATA[<jboss>
<enterprise-beans>
<session>
<ejb-name>nextgen.StatelessSession</ejb-name>
@@ -399,13 +386,16 @@
<clustered>true</clustered>
<cluster-config>
<partition-name>DefaultPartition</partition-name>
- <home-load-balance-policy>org.jboss.ha.framework.interfaces.RoundRobin</home-load-balance-policy>
- <bean-load-balance-policy>org.jboss.ha.framework.interfaces.RoundRobin</bean-load-balance-policy>
+ <home-load-balance-policy>
+ org.jboss.ha.framework.interfaces.RoundRobin
+ </home-load-balance-policy>
+ <bean-load-balance-policy>
+ org.jboss.ha.framework.interfaces.RoundRobin
+ </bean-load-balance-policy>
</cluster-config>
</session>
</enterprise-beans>
-</jboss>
-]]></programlisting>
+</jboss>]]></programlisting>
<itemizedlist>
<listitem>
@@ -450,8 +440,7 @@
In the EJB application, you need to modify the <literal>jboss.xml</literal> descriptor file
for each stateful session bean and add the <literal><clustered></literal> tag.
</para>
-<programlisting><![CDATA[
-<jboss>
+<programlisting><![CDATA[<jboss>
<enterprise-beans>
<session>
<ejb-name>nextgen.StatefulSession</ejb-name>
@@ -459,14 +448,19 @@
<clustered>True</clustered>
<cluster-config>
<partition-name>DefaultPartition</partition-nam>
- <home-load-balance-policy>org.jboss.ha.framework.interfaces.RoundRobin</home-load-balance-policy>
- <bean-load-balance-policy>org.jboss.ha.framework.interfaces.FirstAvailable</bean-load-balance-policy>
- <session-state-manager-jndi-name>/HASessionState/Default</session-state-manager-jndi-name>
+ <home-load-balance-policy>
+ org.jboss.ha.framework.interfaces.RoundRobin
+ </home-load-balance-policy>
+ <bean-load-balance-policy>
+ org.jboss.ha.framework.interfaces.FirstAvailable
+ </bean-load-balance-policy>
+ <session-state-manager-jndi-name>
+ /HASessionState/Default
+ </session-state-manager-jndi-name>
</cluster-config>
</session>
</enterprise-beans>
-</jboss>
-]]></programlisting>
+</jboss>]]></programlisting>
<para>
In the bean configuration, only the <literal><clustered></literal> tag is mandatory to
indicate that the bean works in a cluster. The <literal><cluster-config></literal>
@@ -489,9 +483,7 @@
As the replication process is a costly operation, you can optimise this behaviour by
optionally implementing in your bean class a method with the following signature:
</para>
-<programlisting>
-public boolean isModified();
-</programlisting>
+<programlisting>public boolean isModified();</programlisting>
<para>
Before replicating your bean, the container will detect if your bean implements this method.
If your bean does, the container calls the <literal>isModified()</literal> method and it only
@@ -506,11 +498,10 @@
<para>
The <literal>HASessionStateService</literal> bean is defined in the
<code>all/deploy/cluster/ha-legacy-jboss-beans.xml</code> file.</para>
-<programlisting><![CDATA[
-<bean name="HASessionStateService"
+<programlisting><![CDATA[<bean name="HASessionStateService"
class="org.jboss.ha.hasessionstate.server.HASessionStateService">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=HASessionState", exposedInterface=org.jboss.ha.hasessionstate.server.HASessionStateServiceMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(...)</annotation>
<!-- Partition used for group RPCs -->
<property name="HAPartition"><inject bean="HAPartition"/></property>
@@ -521,8 +512,7 @@
Defaults to 30*60*1000 => 30 minutes -->
<property name="beanCleaningDelay">0</property>
-</bean>
-]]></programlisting>
+</bean>]]></programlisting>
<para>The configuration attributes in the <literal>HASessionStateService</literal> bean are listed below.</para>
<itemizedlist>
@@ -559,13 +549,14 @@
<para>
The 3.2.7+/4.0.2+ releases contain a RetryInterceptor that can be added to the proxy client side interceptor stack to allow for a transparent recovery from such a restart failure. To enable it for an EJB, setup an invoker-proxy-binding that includes the RetryInterceptor. Below is an example jboss.xml configuration.
</para>
-<programlisting><![CDATA[
-<jboss>
+<programlisting><![CDATA[<jboss>
<session>
<ejb-name>nextgen_RetryInterceptorStatelessSession</ejb-name>
<invoker-bindings>
<invoker>
- <invoker-proxy-binding-name>clustered-retry-stateless-rmi-invoker</invoker-proxy-binding-name>
+ <invoker-proxy-binding-name>
+ clustered-retry-stateless-rmi-invoker
+ </invoker-proxy-binding-name>
<jndi-name>nextgen_RetryInterceptorStatelessSession</jndi-name>
</invoker>
</invoker-bindings>
@@ -594,8 +585,7 @@
</client-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
-</jboss>
-]]></programlisting>
+</jboss>]]></programlisting>
</section>
<section>
More information about the jboss-cvs-commits
mailing list