Hello wise and learned folks. My question to you is: I am retrieving the name of the class (the servlet) by using getClass().getName() so that I can also have a URL to the source file available within the function of the servlet upon request. My question is does this method instantiate the class whose name it is trying to get? If it does thats not good business for the web container that I am using (especially since it's use is being lent to me for free). Its best to let the container handle the lifecycle of the servlet, other wise porblems may occur so I need to be wary of bad design. Anybody with some advise on that?
Meadowlark Bradsher
SCJ2P, IBM XML V1, Series 7/63
Mirko Froehlich
Ranch Hand
Joined: Aug 21, 2000
Posts: 114
posted
0
I am not sure I understand exactly what you mean. "getClass.getName()" itself does not instantiate an instance of the class whose name you are determining, but obviously you can only call "getClass()" on an existing object. If you are calling this in a servlet and your question is whether this creates another instance of the servlet, then the answer is no. "getClass()" creates a Class instance, but no instance of the servlet you call it on. -Mirko
Meadowlark Bradsher
Ranch Hand
Joined: Jan 23, 2001
Posts: 109
posted
0
Originally posted by Mirko Froehlich: If you are calling this in a servlet and your question is whether this creates another instance of the servlet, then the answer is no. "getClass()" creates a Class instance, but no instance of the servlet you call it on. -Mirko
That's exactly what I was asking. I justed wanted to be sure that I am not instantiating the servlet myself, on top of letting the container do it. Thanks for your help.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.