Hi,
I am not sure,but reason is main thread closed the output stream & hence
connection is closed. So in another thread it is not printed.
Pankaj
-----Original Message-----
From: Balamurugan.K, AMB Chennai [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 02, 2000 4:03 PM
To: [EMAIL PROTECTED]
Subject: Problem with the thread in the servlet
Hi,
see this code:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ThreadTest extends HttpServlet {
public void doGet(HttpServletRequest
req,HttpServletResponse
res) throws IOException {
T t = new T(res.getWriter());
t.start(); // this is not printing any values.why?
t.say(); // this works well...
}
}
class T extends Thread {
PrintWriter out;
public T(PrintWriter pwt) throws IOException{
this.out = pwt;
}
public say() {
out.println("Working Well----from say()");
}
public void run() {
out.println("Working Well----from Thread");
}
}
This program prints only for say() method, whereas it is not
printing anything when i call this thru thread.
can any one tell why .......?
Regards,
Balamurugan K,
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html