-
1. Re: EJB3 business delegates?
deanouk May 14, 2009 1:14 PM (in response to meselfe)I'd love an answer to this.
I'm too perplexed about caching a reference to the Session bean.
Would this result in better performance?
Would it enforce the use of the same instance, thus negating the benefits of the pool? -
2. Re: EJB3 business delegates?
alrubinger May 14, 2009 1:28 PM (in response to meselfe)You should absolutely cache SLSB proxies. Do the lookup once, then you may pass around and share this instance.
This is because the proxy you lookup may target *any* of the underlying bean instances in the pool. Assuming you've done a good job to ensure your SLSB has no *conversational state*, all SLSB proxies are identical from the perspective of the caller/client. This means that if your SLSB has internal instance variables, they must *not* be exposed out.
ie. Instance variables initializing some internal state for your SLSB == OK. Caching user authorization tying some bean instance to a particular request or caller == Bad.
For conversational state, use SFSB. These may not be cached in the same fashion, in that each "conversation" should reference the same SFSB instance and no others.
S,
ALR