[jboss-dev-forums] [Design of EJB 3.0] - Re: Passivating EJB 3 Stateful Session Beans stops the World
andy.miller@jboss.com
do-not-reply at jboss.com
Wed Oct 22 20:01:11 EDT 2008
"bstansberry at jboss.com" wrote : 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.
I do have the above in my ejb3-interceptors-aop.xml.
Here is the behavior I see:
With just @Clustered and no Cache or CacheConfig annotation, I get the StatefulTreeCache.
I think you say that using jboss.cache:service=EJB3SFSBClusteredCache doesn't work, and you would be correct. I had that, and I get no deployment error, but I still get StatefulTreeCache.
With @Clustered and @CacheConfig(name="sfsb-cache", maxSize=125000) I still get StatefulTreeCache (not the EJB3SFSBStatefulTreeCache), and the size shows -1 in the jmx-console, and when I run it I still only get 10,000 as the max size. I just figured 10,000 because it never goes above that when refreshing, and when it gets close to that size is when passivation occurs.
This just doesn't appear to be working correctly at all.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184013#4184013
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184013
More information about the jboss-dev-forums
mailing list