we need to use SFSB? Why the answer for this question is SFSB and not SLSB?
Q:"In your web application, your Servlet will need to cache the bean stub as an attribute in the HttpSession object. The HTTP session's state will therefore be tracked and stored in the bean instance. If the client invokes method calls against the same bean stub, the calls are always tunneled to the same bean instance in the container."
If you are storing state in HttpSession then SFSB is not required. However if you are using SFSB & the client of SFSB is web layer then you will need to keep the handle of SFSB in HttpSession to ensure that all requests are routed to the same SFSB.
What if the presentation tier and business tier are on different JVMs and SFSB on one of the nodes of the cluster fails? Do you still think that all requests will be routed to the same SFSB? Essentially speaking what you are mentioning isn't it session affinity?
The session affinity/sticky session part will need to be taken care by the web server. By this I mean that the web server running in front of app server will handle this. Session affinity will ensure that the request will always go to the server handling the users request. This will get interesting if the server crashes. In case session replication is supported the session will be availaible on another node which will take over, however am not very sure if SFSB handles are serializable & will be replicated to the other node.
However if you are using SFSB & the client of SFSB is web layer then you will need to keep the handle of SFSB in HttpSession to ensure that all requests are routed to the same SFSB.
Does web layer has identity? Does web layer independently need to maintain session with SFSB? I thought both HttpSession and SFSB are independent solution of maintaining session with the later being more sophisticated and there is no need to mix them, may be i am wrong.
Yes HttpSession is an alternative to SFSB , but using SFSB in web layer means that we also need to use HttpSession.
Frankly in terms of using stateful beans i have personally not come across a application where stateful beans are used. A major factor is that that stateful beans don't scale very well.