>From: Michael Bergknoff <[EMAIL PROTECTED]>
>Does the container maintain session state across
>a destroy/init sequence? If so is it up to each
>servlet to serialize or delete any objects stored
>in the session? For debugging, is it possible to
>control when the destroy method is called?
>
>Thanks,
>Mike
>[...]


Hi :-) I am not sure:
- IMHO, I think HttpSession doesn't has much relation
  with one special MyServlet,  session is "of"
  webapps/container(not this webapp or that...), i.e.,
  session is cross-webapp, so session is loaded by
  another classloader which is different from the webapp
  classloader which loads MyServlet. so even if the old
  webapp classloader is destroyed/GCed, the session object
  and its Class object and its classloader are still there.

- it seems that the following "events" are Not
  always "together":
  % MyServlet is loaded by webapp classloader
  % and 1/n instance(s) is/are made
  % init method is called by container
  % destroy method is called by container
  % 1/n instance(s) is/are destroyed/GCed
  % another 1/n instance(s) is/are made again
  % old webapp classloader is destroyed/GCed
  % new webapp classloader is made again
  % ...

  i.e. I guess it is possible that:
  destroy method is called, but the old instance of
  MyServlet is still there(and/or the old webapp classloader
  is still there).

- so if we are sure that all the objects which are put into
  session by us are Not loaded by webapp classloader, I think
  we can be sure that we don't need to consider the init/destroy
  issue, if they are loaded by webapp classloader, And at the same
  time when init/destroy is being called, the old webapp classloader         
   is destroyed/GCed and a new one is made, perhaps we will meet some        
    problem, for xample, ClassCastException or other...

- perhaps it is better to make all the following serialized:
  %  the objects which are put into HttpSession
  %  the objects which are put into ServletContext



Bo
May.06, 2001

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Reply via email to