[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 22:53:15 EDT 2008


"bstansberry at jboss.com" wrote : "andy.miller at jboss.com" wrote : 
  |   | 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.
  | 
  | Good.
  | 
  | anonymous wrote : 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.
  | 
  | No, that's not what I meant; what you see is what I expect.
  | 
  | There's a couple of concepts here; one of which users normally don't need to worry about, the other they do.
  | 
  | The first is what implementation of the "StatefulCache" interface EJB3 will use. This is the one users normally don't have to worry about. That interface defines the SPI the EJB3 container uses to interact with the caching subsystem. "StatefulTreeCache" is an implementation of that SPI that knows how to interact with JBC.  "SimpleStatefulCache" is an implementation that works with the filesystem.
  | 
  | You only became aware of this stuff because you had the @Clustered package issue that caused EJB3 to use the wrong one. With that fixed, with @Clustered you should always see "StatefulTreeCache".
  | 
  | The second concept is how to configure whatever impl of StatefulCache is used.  That's an end user concern and is done via the @CacheConfig annotation.  The ejb3-interceptors-aop.xml stuff you saw is just a way of setting defaults if you don't add the annotation yourself.
  | 
  | StatefulTreeCache uses the @CacheConfig.name attribute to tell it what JBoss Cache configuration to use.  It gets the JBC instance from the CacheManager service by passing in the @CacheConfig.name value.  The standard value it should pass in is "sfsb-cache", but if it passes in the legacy AS 4.x default value of "jboss.cache:service=EJB3SFSBClusteredCache", the CacheManager knows that's just an alias for the AS 5.x default of "sfsb-cache".
  | 
  | So, this part sounds like its working just fine.
  | 
  | anonymous wrote : 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.
  | 
  | Yes, why the config value of maxSize=100,000 doesn't seem to be respected is what I need to figure out.

Thanks for explaining.  I was misunderstanding the legacy part.

One final question.  If I remove the @CacheConfig annotation, can I add the maxSize and the other parameters to the ejb3-interceptors-aop.xml, like it has for the other two entries?

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

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



More information about the jboss-dev-forums mailing list