Nitin Mangtani wrote:

> I wanted to ask should my getSquare method be synchronized, if not
> then why. Because as far as my understanding goes whenever the new
> client request comes new thread is created only for service methods
> and not other methods.

No need for synchronization.  A thread is dispatched to call doPost()
but then when doPost() calls getSquare() the same thread takes care of
it.  You're OK so long as you're not using instance variables to pass
data between methods.  This is standard threading stuff, and really
isn't any different for servlets.  For more information I'd recommend a
book on basic Java threading.

> (2) I have a servlet and separate class.

No different.

-jh-

--
Jason Hunter
[EMAIL PROTECTED]
Book:    http://www.servlets.com/book
Article: http://www.javaworld.com/jw-12-1998/jw-12-servletapi.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

Reply via email to