Clustering with Stateful Session Beans in JBoss

Clustering with Stateful Session Beans in JBoss

Stateful Session Beans have a state for a client

Fail-over and Reliability ⇒ Fault-tolerant

State managed by JBoss Cache

To enable clustering for SFSB, it works the same way as clustering SLSB except that:

  • There is only one load-balancing policy available: FirstAvailable (default for SFSB)
  •  This time JBoss Cache is used because the state has to be managed

sfsb-cache cache configuration is located in:

  • deploy/cluster/jboss-cache-manager.sar/META-INF/jboss-cache-configs.xml(You can enable this file in the jboss-cache-manager-jboss-beans.xml file): Describes cache configuration using the standard JBC 3.x config format
  •  deploy/cluster/jboss-cache-manager.sar/META-INF/jboss-cache-manager-jboss-beans.xml: Describes cache configuration using the microcontainer format

Aspired to become an JBOSS Experience Manager?

Explore the post to discover the know-hows on JBOSS Traingin.

These configuration affect all SFSB. You can override this configuration for your SFSB though:

  • By annotating with @org.jboss.ejb3.annotation.CacheConfig
  •  In the jboss.xml file with <cache-config>...</cache-config>

The parameters you can configure are the following:

  •  idleTimeoutSeconds: Time in seconds a SFSB can be unused before being passivated (default 300)
  •  maxSize: maximum number of beans that can be cached (default 10000)
  • name: Specify the name of the cache configuration. sfsb-cache is the default for SFSB
  • removalTimeoutSeconds: Time in seconds a SFSB can be unused before being deleted by the cache (default 0)
  •  replicationIsPassivation: Should a replication be considered as passivation? (default true)

Example: To disable passivation, you could set idleTimeoutSeconds and maxSize to 0.

For indepth understanding on JBoss click on: