I Have a Servlet to Show up a Login Page and when i Enter the URL the Servlet has been specified by a separate Thread and do the work.But Even After Committing the Response (i.e) After Finishing the Job the Thread is still Alive why does it does so? The Alive Status Shows True after im getting the Response in the Page.
Code:
public class LoginNew extends HttpServlet implements Runnable {
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter writter = response.getWriter();
writter.println(
"<!DOCTYPE html>" +
"<html>" +
"<form>" +
"<div style=\"text-align:center\">UserName :<input type=\"text\" name=\"UserName\"><br>" +
"<div style=\"text-align:center\">Password :<input type=\"password\" name=\"Password\"><br>" +
"<div style=\"text-align:center\">TimeOut Interval :<input type=\"text\" name=\"TimeOut\"><br>" +
"<div style=\"text-align:center\">No TimeOut :<input type=\"checkbox\" name=\"NoTimeout\" value=\"1\"> NoTimeout <br><br>" +
"<input type=\"submit\" formaction=\"Home\" formmethod=\"post\" value=\"Login\" />" +
" "+
"<input type=\"submit\" formaction=\"SignUp\" formmethod=\"post\" value=\"SignUp\" />" +
"</form>" +
"</body>" +
"</html>"
);
Thread.currentThread().sleep(60000);
System.out.println("After Commitment Thread -> "+Thread.currentThread().getName()+" Alive Status--> "+Thread.currentThread().isAlive());
}
}