[jboss-dev-forums] [Design of EJB 3.0] - Re: Passivating EJB 3 Stateful Session Beans stops the World

bstansberry@jboss.com do-not-reply at jboss.com
Wed Oct 22 19:40:17 EDT 2008


You would add an @CacheConfig annotation:

@org.jboss.ejb3.annotation.CacheConfig (name="sfsb-cache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)

The maxSize param controls the max number of beans.

If you don't configure that, and your bean is @Clustered, per the deploy/ejb3-interceptors-aop.xml I have in my workspace, the following should be added to your bean:

@org.jboss.ejb3.annotation.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)

It already has a maxSize of 100,000 so I'm not sure how you're ending up with only 10,000. I'll poke around.

The name="jboss.cache:service=EJB3SFSBClusteredCache" bit needs to be fixed: https://jira.jboss.org/jira/browse/JBAS-6128 . The way StatefulTreeCache uses that value in AS 5 is to drive a lookup in the CacheManager service, deployed via deploy/cluster/jboss-cache-manager.sar.  CacheManager is an on-demand factory for JBoss Cache instances. It's maintains a registry of named JBC configurations, and provides caches based on the name.

The name here should be "sfsb-cache".  The cache manager is configured to understand the old 4.x name "jboss.cache:service=EJB3SFSBClusteredCache" to be an alias for "sfsb-cache". That allows pre-existing code to work.

If you actually wanted to play around with the "sfsb-cache" JBC configuration, you could edit deploy/cluster/jboss-cache-manager.sar/META-INF/jboss-cache-configs.xml. But I don't think that's what you are looking for; you don't control things like the max # of beans via JBC configuration; it's via @CacheConfig.

Obviously this needs documenting. :(

Does the deploy/ejb3-interceptors-aop.xml file on your JBoss install include this?

<annotation expr="!class(@org.jboss.ejb3.annotation.CacheConfig) AND class(@org.jboss.ejb3.annotation.Clustered)">
  |          @org.jboss.ejb3.annotation.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
  |       </annotation>
  | 

If your maxSize value were something different, that would explain it.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184011#4184011

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184011



More information about the jboss-dev-forums mailing list