Pascal Thivent mentions here that -
If you are using
SFSB
, then you mustavoid
injecting them into classes that aremultithreaded
in nature, such asServlets
andJSF managed
beans
(you don't want it to be shared by all clients).
Moving swiftly on, BalusC also put forwards the same thing here-, but indirectly.
....use SFSB only when you want a real stateful
session
bean
Consider a Session Scoped Managed bean-
@SessionScoped
public class Bean{
@EJB
EjbBean ejbBean;
}
with
@Stateful
public class EjbBean{
}
But the above SessionScoped
bean will be linked to one
client only and as such will have state/ instance variables
different from other
session scoped bean. Subsequently, any stateful EJB bean
will not be shared by other clients.
Please suggest on what the author implies when he says-
you don't want it to be shared by all clients
I do perfectly understand the difference b/w HttpSession
& the session
word in Stateless Session Bean
.