Thank you! I was wondering whether this should be better done inside of an request scope like:
public class StartServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.getSession().setAttribute("task", new Task());
}
}
This way, the process is stopped when the user leaves the page.