can sessions be periodically recycled depending on server load?
With servlets/jsp, can sessions be recycled by the web container (say tomcat), depending on how much traffic a site is getting?
Update By recy开发者_StackOverflow中文版cled I mean, the tomcat container will wipe it out since it is running out of memory or busy trying to server requests for another website on the same server
This happens with IIS and .net
According to the API specification, a servlet container is not allowed to invalidate or delete a session before the session timeout is reached (it is however allowed to keep it longer than the session timeout). To cope with a high number of simultaneous sessions, most servlet containers can be configured to persist sessions to disk or to a database, allowing the container to free memory, but still being able to restore the session later if it is required. It is therefore required by the specification that all objects stored in the session must be serializable, although most servlet containers (also Tomcat) do not check this explicitly.
You can specify period of time after which user's session will expire.
Do you mean re-cycled as in re-used? or re-cycled as in terminated?
They should never be re-used. They will be terminated after a timeout. Last time I used Tomcat I don't believe it had the facility to destroy sessions under load, other servers might but I've never seen this facility
精彩评论