-
1. Re: Caching behavior in EJB container
ben.wang Jan 12, 2006 3:25 AM (in response to ben.wang)Scott's follow up comment:
A bean with an active method cannot be passivated and the reason we do not obtain the lock is described in a comment right before the attemptSync call about a deadlock problem. Not passivating is not a huge deal in general as it should only result in a transient excess of beans. The removal of the bean from the cache is a problem.
To block the call, the deacklock problem would have to be revisted to validate what is going on. There is a user forum post saying that we are creating sfsb instances that end up being thrown away if the session is activated so we may need to revisit the cache behavior. We could also have a notion of lazy passiviation that would result in marking the bean as would have been passivated so that it can be passivated after the current call ends. One potential problem with this is that time based passivation that fails to passivate an active instance should simply fail as its a race condition between the background timer and active usage. We should discuss the issues in the forums as I'm sure Bill has other cache implementations in ejb3 that need to be validated as well. -
2. Re: Caching behavior in EJB container
ben.wang Jan 14, 2006 9:17 PM (in response to ben.wang)OK, I am proposing to simply allow the cache size to grow without passivating it temporarily then. I have created a Jira issue for that:
http://jira.jboss.com/jira/browse/JBAS-2668 -
3. Re: Caching behavior in EJB container
gmyrek Jan 17, 2006 2:44 PM (in response to ben.wang)"ben.wang@jboss.com" wrote:
Scott's follow up comment:
To block the call, the deacklock problem would have to be revisted to validate what is going on. There is a user forum post saying that we are creating sfsb instances that end up being thrown away if the session is activated so we may need to revisit the cache behavior. We could also have a notion of lazy passiviation that would result in marking the bean as would have been passivated so that it can be passivated after the current call ends. One potential problem with this is that time based passivation that fails to passivate an active instance should simply fail as its a race condition between the background timer and active usage. We should discuss the issues in the forums as I'm sure Bill has other cache implementations in ejb3 that need to be validated as well.
I played a bit with SFSB cache. I created a cache with max size 2 and created several SFSB (but not concurrently) to see how they are passivated/activated. Below the sequence of client calls and container actions:1. client create -> new instance 1 -> set session context 1 -> create 1 2. client create -> new instance 2 -> set session context 2 -> create 2 3. client create -> new instance 3 -> set session context 3 -> create 3 -> passivate instance 1 4. client create -> new SFSB instance 4 -> set session context 4 -> create 4 -> passivate instance 2 5. client calls business method on bean 1 -> new instance 5 -> set session context 5 -> set session context 1 -> activate 1 -> passivate 3 -> business method on 1
So, bean instance 5 is created but never used ie. calling a business method on a passivated bean causes creation of a new bean instance for nothing.
Regards,
Marek.