I have to create a common service available to JSP pages or Servlets, using Tomcat; the server has standalone logics, such that I have to keep a running process even if no user are connected to the JSP pages, and when any user load a page the same server process is available to that page.
How can I make the JVM\Tomcat to keep up that thread or process mantaining its interface available to the pages?
Use a ServletContextListener to start a thread when the application starts, and stop this thread when it stops. Make the object encapsulating this thread available to all the pages by placing it in an attibute of the ServletContext.