-
1. Re: Passivating EJB 3 Stateful Session Beans stops the World
andy.miller Oct 20, 2008 7:55 PM (in response to andy.miller)Some additional information:
I tested changing the cache maxSize parameter with ejb3-interceptors-aop.xml, and discovered that I am actually using the SimpleStatefulCache. I'm not really sure why. Perhaps something I need to have on the @Clustered annotation?
Right now, even though I am using a clustered configuration of AS 5 CR2, I don't have another node joining the cluster, but I wouldn't expect the cache to be different based on that. -
2. Re: Passivating EJB 3 Stateful Session Beans stops the World
brian.stansberry Oct 20, 2008 8:06 PM (in response to andy.miller)I'll have a look at how the choice of cache implementation is working in the absence of an explicit @CacheConfig annotation. I'm assuming there's no @CacheConfig annotation; please correct me if I'm wrong.
-
3. Re: Passivating EJB 3 Stateful Session Beans stops the World
alrubinger Oct 20, 2008 8:13 PM (in response to andy.miller)"andy.miller@jboss.com" wrote:
I can probably reduce the code down to just the servlet and stateful session bean, and strip out the database access, and just put a sleep in the method implementation.
In the end we're going to need a more isolated case that may involve invocations on an SFSB alone, or preferably something to test Cache passivation directly. Then we may apply the same test to any of our cache implementations.
S,
ALR -
4. Re: Passivating EJB 3 Stateful Session Beans stops the World
alrubinger Oct 20, 2008 8:16 PM (in response to andy.miller)"andy.miller@jboss.com" wrote:
I tested changing the cache maxSize parameter with ejb3-interceptors-aop.xml, and discovered that I am actually using the SimpleStatefulCache. I'm not really sure why. Perhaps something I need to have on the @Clustered annotation?
This shouldn't be. We add the proper default annotations if not specified in AOP (ejb3-interceptors-aop.xml):<!-- Clustered cache configuration --> <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND class(@org.jboss.ejb3.annotation.Clustered)"> @org.jboss.ejb3.annotation.Cache ("StatefulTreeCache") </annotation> <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>
S,
ALR -
5. Re: Passivating EJB 3 Stateful Session Beans stops the World
alrubinger Oct 20, 2008 8:20 PM (in response to andy.miller)"andy.miller@jboss.com" wrote:
I tested changing the cache maxSize parameter with ejb3-interceptors-aop.xml, and discovered that I am actually using the SimpleStatefulCache.
Something I noted w/ SimpleStatefulCache:
Without seeing this firsthand, my educated guess is in SessionTimeoutTask.run() where we synchronize on the entire SimpleStatefulCache.cacheMap to do passivation; this will queue up all other Threads looking to create or get a session as they wait to acquire the lock.
http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/simple/SimpleStatefulCache.java
S,
ALR -
6. Re: Passivating EJB 3 Stateful Session Beans stops the World
andy.miller Oct 20, 2008 9:53 PM (in response to andy.miller)"bstansberry@jboss.com" wrote:
I'll have a look at how the choice of cache implementation is working in the absence of an explicit @CacheConfig annotation. I'm assuming there's no @CacheConfig annotation; please correct me if I'm wrong.
Yes, you are correct, there is not @CacheConfig annotation. Only the @Clustered annotation. -
7. Re: Passivating EJB 3 Stateful Session Beans stops the World
andy.miller Oct 20, 2008 9:56 PM (in response to andy.miller)"ALRubinger" wrote:
"andy.miller@jboss.com" wrote:
I tested changing the cache maxSize parameter with ejb3-interceptors-aop.xml, and discovered that I am actually using the SimpleStatefulCache. I'm not really sure why. Perhaps something I need to have on the @Clustered annotation?
This shouldn't be. We add the proper default annotations if not specified in AOP (ejb3-interceptors-aop.xml):<!-- Clustered cache configuration --> <annotation expr="!class(@org.jboss.ejb3.annotation.Cache) AND class(@org.jboss.ejb3.annotation.Clustered)"> @org.jboss.ejb3.annotation.Cache ("StatefulTreeCache") </annotation> <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>
S,
ALR
I do have what you list above in my configuration. Just before it is also the non-clustered configuration, and that is what I'm picking up, based on my experimentation.
I think Brian will discover a problem with the way this is being selected when there is no @CacheConfig annotation. -
8. Re: Passivating EJB 3 Stateful Session Beans stops the World
andy.miller Oct 20, 2008 9:57 PM (in response to andy.miller)"ALRubinger" wrote:
"andy.miller@jboss.com" wrote:
I can probably reduce the code down to just the servlet and stateful session bean, and strip out the database access, and just put a sleep in the method implementation.
In the end we're going to need a more isolated case that may involve invocations on an SFSB alone, or preferably something to test Cache passivation directly. Then we may apply the same test to any of our cache implementations.
S,
ALR
I will work on cutting out just the code for the Stateful Session Bean, so it can be turned into an isolated test case tomorrow. -
9. Re: Passivating EJB 3 Stateful Session Beans stops the World
brian.stansberry Oct 22, 2008 1:53 PM (in response to andy.miller)Andy,
Can you post the class declaration for the troublesome bean (along w/ any class annotations) plus any ejb-jar.xml or jboss.xml that impacts the bean?
Looking at this, how it determines the cache implementation to use looks pretty straightforward. I misspoke before; it's driven by the org.jboss.ejb3.annotation.Cache annotation, not @CacheConfig. -
10. Re: Passivating EJB 3 Stateful Session Beans stops the World
andy.miller Oct 22, 2008 2:45 PM (in response to andy.miller)Brian,
Sure thing. I don't have any ejb-jar.xml or jboss.xml files at all. I tried to use all the defaults as well (convention over configuration) for everything that I could. So here is the class declaration:package services.ejb; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.ejb.Remove; import javax.ejb.Stateful; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.jboss.annotation.ejb.Clustered; import services.entities.Order; @Clustered @Stateful public class OrderInquiryBean implements OrderInquiry, Serializable {
Here is the interface as well:package services.ejb; import java.util.List; import services.entities.Order; public interface OrderInquiry { public int getPaginationForInquiries(); public List<Order> findOrdersByCustomer(long customerId); public void cancelSession(); }
Like I said. I kept everything as simple as possible. -
11. Re: Passivating EJB 3 Stateful Session Beans stops the World
andy.miller Oct 22, 2008 2:54 PM (in response to andy.miller)"bstansberry@jboss.com" wrote:
Andy,
I misspoke before; it's driven by the org.jboss.ejb3.annotation.Cache annotation, not @CacheConfig.
Actually, you were correct according to the documentation. The @Cache annotation is for caching entities, and the @CacheConfig is for StatefulSessionBeans, like what I'm doing. -
12. Re: Passivating EJB 3 Stateful Session Beans stops the World
brian.stansberry Oct 22, 2008 3:22 PM (in response to andy.miller)I believe you are thinking of org.hibernate.annotations.Cache, which is used for entities. The org.jboss.ejb3.annotation.Cache annotation is new and is used to drive what SFSB cache implementation to use. As Andrew's snippet shows, the presence of @Clustered should drive the addition of @org.jboss.ejb3.annotation.Cache ("StatefulTreeCache") which in turn should result in StatefulTreeCache being used.
But apparently it doesn't. :)
Thanks for the config details; that's what I guessed you were doing, but now I know. Hopefully if I can reproduce. -
13. Re: Passivating EJB 3 Stateful Session Beans stops the World
alrubinger Oct 22, 2008 3:26 PM (in response to andy.miller)Andy:
And the test client?
S,
ALR -
14. Re: Passivating EJB 3 Stateful Session Beans stops the World
andy.miller Oct 22, 2008 3:32 PM (in response to andy.miller)"ALRubinger" wrote:
Andy:
And the test client?
S,
ALR
I had to work on FY'10 budget stuff until late last night, and I had to sit on a call from 6:30 this morning to go over it with a bunch of folks, so I'm just now getting around to creating a slimmed down test case.