Example:
import javax.servlet.*;
public class StartupServlet extends HttpServlet {
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
ServiceManager serviceManager = ServiceManager.getInstance();
serviceManager.startServices();
}
public void destroy() {
ServiceManager serviceManager = ServiceManager.getInstance();
serviceManager.stopServices();
super.destroy();
}
}
web.xml
ServiceManager serviceManager = ServiceManager.getInstance();
ReplyDeleteWhat is ServiceManager class? and what it does?
Which java package it belongs to?
if it is a user defined class can you post snippet of it?
Thanks,
Srikanth
Hey Srikanth,
ReplyDeleteServiceManager is an example here. You need to add your required services in the init mehtod to start and in destroy mehtod stop services. Servlet will make sure that these methods are called.
Moreover there are O/S related service managers available which can be included similar to this hence I have not included any specific methods.
HTH
RC2