Esam<br />SCJP 1.4, SCWCD 1.4
Esam<br />SCJP 1.4, SCWCD 1.4
> "but if we configure the web server to have multiple instance say 10 instances of a servlet A"
How exactly would you configure that?
by any chance not more than one instance of any servlet would be created by the container..
Originally posted by Priya Jothi:
Remember one thing clearly..by any chance not more than one instance of any servlet would be created by the container..also u have no means to instruct the container to do so.Only one instance of any servlet will be created by the container(no servlet will be given excuse for this!!) and when multiple request comes seperate thread will be spawned and each request from the client will be executed by the thread's service method.Init & destroy method would be executed for only on that servlet instance.
Esam<br />SCJP 1.4, SCWCD 1.4
Esam<br />SCJP 1.4, SCWCD 1.4
Esam<br />SCJP 1.4, SCWCD 1.4
Esam<br />SCJP 1.4, SCWCD 1.4
You might hear people say thing slike, "Each instance of the servlet..." but that's just WRONG. There aren't multiple instances of any servlet class, EXCEPT in one special case called SingleThreadModel, which is inherently evil...
From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Originally posted by Esam Ahmed:
I believe Gouri is right.
The most important aspect is that the instance is related to a specific servlet configuration.
If 7 request comes for a specific servlet...only one instance is created for a specific servlet.
From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Originally posted by Gouri Bargi:
Hi Priya,
I checked this in Tomcat. Configuring one servlet twice as Satish has mentioned works, and two instances of the servlet get created.
Basically, I think, we are asking the container to create two servlets here, and both servlets instances happen to belong to the same class.
- Gouri
From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Originally posted by Nicky Eng:
as you said that "...and two instances of the servlet get created."
i'm not understand of "two instances of the servlet get created."....were you saying 2 instance of the servlet class get created???
--------------------------
instance of servlet
instance of servlet class
---------------------------
these 2 statements are totally different right?
I checked this in Tomcat. Configuring one servlet twice as Satish has mentioned works, and two instances of the servlet get created.
Basically, I think, we are asking the container to create two servlets here, and both servlets instances happen to belong to the same class.
Originally posted by Gouri Bargi:
Hi Nicky,
I mean 2 instances of the servlet class.
- Gouri
From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Sep 14, 2005 2:36:43 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /Beer-v1 from URL file:E:\Tomcat 5.0\webapps\Beer-v1
Sep 14, 2005 2:36:43 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /jsp-examples from URL file:E:\Tomcat 5.0\webapps\jsp-examples
Sep 14, 2005 2:36:43 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /phone from URL file:E:\Tomcat 5.0\webapps\phone
Sep 14, 2005 2:36:43 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path from URL file:E:\Tomcat 5.0\webapps\ROOT
Sep 14, 2005 2:36:43 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /servlets-examples from URL file:E:\Tomcat 5.0\webapps\servlets-examples
Sep 14, 2005 2:36:44 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /Test11 from URL file:E:\Tomcat 5.0\webapps\Test11
Sep 14, 2005 2:36:44 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(E:\Tomcat 5.0\webapps\Test11\WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Sep 14, 2005 2:36:44 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /Tester from URL file:E:\Tomcat 5.0\webapps\Tester
Sep 14, 2005 2:36:44 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /tomcat-docs from URL file:E:\Tomcat 5.0\webapps\tomcat-docs
Sep 14, 2005 2:36:44 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /webdav from URL file:E:\Tomcat 5.0\webapps\webdav
Sep 14, 2005 2:36:44 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 14, 2005 2:36:45 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Sep 14, 2005 2:36:45 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63 config=E:\Tomcat 5.0\conf\jk2.properties
Sep 14, 2005 2:36:45 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 10766 ms
Inside BeerSelect constructor
Inside init method
From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Esam<br />SCJP 1.4, SCWCD 1.4
Esam<br />SCJP 1.4, SCWCD 1.4
From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Acetylsalicylic acid is aspirin. This could be handy too:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|