Hi,
If I create an object in init() method of a servlet. What will be its life duration ? Will it be there till servlet is loaded in memory of Application Server or will it be out of scope as soon as init() method execution ends ?
Thanks,
Badrish
-
Life of an object (1 messages)
- Posted by: Badrish Agarwal
- Posted on: February 12 2004 08:04 EST
Threaded Messages (1)
- Life of an object by David Rabinowitz on February 12 2004 09:36 EST
-
Life of an object[ Go to top ]
- Posted by: David Rabinowitz
- Posted on: February 12 2004 09:36 EST
- in response to Badrish Agarwal
That depends on the reference to the object. If you put it in the ServletContext (or some other long living object) then it will live for long time. If the only reference to it is from a local variable in the init(), then it will be out of scope as soon as the init() finishes (like any local variable).
David