Click to See Complete Forum and Search --> : function for every request


Monika
September 27th, 2000, 03:36 AM
Hi,
I am making a servlet in which I have made user defined functions eg myfunction(). Now doGet()
is instantiated for every request and it is calling myfunction().I want to know whether myfunction() too, would be instantiated every time ,or not?

Thanks in advance.
Monika

unicman
October 1st, 2000, 04:21 PM
In java a method is never instantiated. What is instantiated is a class.

In case of servlets... normal servlet will be instantiated only ONCE. After that there will be different threads for each request which will run methods in that class (like multi-threading).

If you make the servlet 'Single-Threaded', then also that servlet 'class' is instantiated for each request and not only specified method.

- UnicMan
http://members.tripod.com/unicman