This is an old thread, but I was browsing archives and had a contribution
to make.

Thomas Munro wrote:

> I have a (1) JSP session which stores a reference to (2) a stateful
> session EJB.  If either times out, I want the user to be bounced to a
> page where they have to log in (again).  The problem is that the JSP
> session and the session EJB time out under different conditions -- that
> is to say, merely surfing around the web application will keep the JSP
> session alive, but the EJB is only kept alive by accessing it, which
> doesn't necessarily happen on every page.  Otherwise, I could simply set
> the EJB to timeout after a longer time than the JSP session.

This was discussed and the best suggestion (from Kevin Duffey) was to use
stateless beans and keep all state in the HttpSession.

However, if you are architecturally obliged to use stateful beans, part of
the solution might be to make the bean timeout very long, and set a
HttpSessionBindingListener (HSBL) attribute in the HttpSession (you could
accomplish this with useBean in session scope). Your HSBL is then
signalled by the servlet container to cleanly handle the case (e.g.
calling homeinterface.remove(mysession) ) where the JSP session times out
before the long-lived stateful session bean.

This doesn't make things any prettier if you restart the EJB container, or
if you have to have a short timeout for the session bean, but it might fit
your model.

J

-[ Joshua Goodall ]-----------------------------------------------              
-[ Chief Systems Architect, IP R&D ]----- Cook, Geek, Lover ------              
-[ [EMAIL PROTECTED] ]--------------- [EMAIL PROTECTED] --              


Reply via email to