I am runnig a web application on tomcat 5.5.
How can I force dump of a session into disk
- on each request
- on each interval of time
I am runnig a web application on tomcat 5.5.
How can I force dump of a session into disk
Question 1 could be done using a filter or valve:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws java.io.IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
HttpSession session = req.getSession(false);
if(session != null) {
dumpSession( session );
}
chain.doFilter(request, response);
}
}
For Question 2 see this discussion
Look at Persistent Manager http://tomcat.apache.org/tomcat-5.5-doc/config/manager.html Setting maxIdleBackup and maxIdleSwap to 0 or near-zero time would persist session on every request. Setting these parameters to bigger value will give You dump in intervals.