One of our programmers recently wrote a servlet ("myServlet") that contains
the following piece of code:
myServlet t = new myServlet();
myThread = new Thread(t);
myThread.start();
The servlet he wrote ("myServlet") implements Runnable. When called the
servlet performs as expected. The question I have is, what is taking place
when the call to < myServlet t = new myServlet() > is made? I was under
the impression sevlets didn't have a constructor, so what is the call to
'new' instantiating?
Regardless of the servlet constructor question I recommended that he change
the code to
myThread = new Thread( this );
myThread.start();
because the new instantiation seems unecessary. I would still like to know
why the first version worked if servlets don't have constructors. Can
anyone shed some light?
David S. Soleno
SciberNet, Inc.
Tel: (619) 824-0840
Fax: (619) 824-0846
e-mail: [EMAIL PROTECTED]
___________________________________________________________________________
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