(1) I have a servlet
class TestServlet extends HttpServlet
{
public void doPost(res,req)
{
int val = req.getObject(); //not exact sytanx,
basically this value is send by client.
int sqval = getSquare(val);
}
int getSquare(int i)
{
int sqval = i*i:
return sqval;
}
}
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.
(2) I have a servlet and separate class.
class TestServlet extends HttpServlet
{
public void init(ServletConfig config)
throws ServletException
{
super.init(config);
Square s1 = new Square();
}
public void doPost(res,req)
{
int val = req.getObject(); //not exact sytanx,
basically this value is send by client.
int sqval = s1.getSquare(val);
}
}
public class Square
{
public int getSquare(int i)
{
int sqval = i*i:
return sqval;
}
}
Should I in this case make getSquare as synchronized method.
Regards Nitin.
___________________________________________________________________________
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