-
1. Re: Can SLSB be dirty after new injection?
wolfc Jul 6, 2007 5:06 PM (in response to gena777)Yes, a stateless session bean is kept in a method-ready pool. So each instance is reused.
To invalidate a stateless session bean throw a RuntimeException that has not been marked as an application exception from a business method. (EJB 3 Core 4.5.3) -
2. Re: Can SLSB be dirty after new injection?
gena777 Jul 7, 2007 8:27 AM (in response to gena777)@wolfc thank you for the answer!
its a pity, that a small error (misunderstanding of this aspect of ejb-spec) results in a total instability of a whole application. I think, its really confusing, to get a dirty new injected STATELESS bean from a container.
Couldn't it be better, to purge the dirty SLSB and from some threshold to fill the pool with new instances?
Are there some important reason why the SLSBs aren't one way? Is it really so expensive, to create asynchronously thousands of whole instances of a bean and put them on demand to the method-ready pool?
Isn't the throwing an exception an expensive way to remove the dirty instance?
Thank you and excuse my nosiness!
Gena -
3. Re: Can SLSB be dirty after new injection?
wolfc Jul 9, 2007 4:37 AM (in response to gena777)"gena777" wrote:
Couldn't it be better, to purge the dirty SLSB and from some threshold to fill the pool with new instances?
You can create your own interceptor which determines if you use a new instance and when to discard it. See http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessInstanceInterceptor.java?view=markup"gena777" wrote:
Are there some important reason why the SLSBs aren't one way? Is it really so expensive, to create asynchronously thousands of whole instances of a bean and put them on demand to the method-ready pool?
Yes and yes. Injection can become quit heavy. But each application is different, you'll have to benchmark when you got your new interceptor up and running."gena777" wrote:
Isn't the throwing an exception an expensive way to remove the dirty instance?
Yes, if you want open a new feature issue in JIRA. An extension of SessionContext with a setDiscard method might be the solution.