Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

instance of server

 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
" only one instance of the server can be credated inside a given JVM" - This is from tomcat book

how is the instance of a server created ? I mean when I want create an object, it requires a program to instanciate an object. I dont see any program in here. Which program instanciates the server instance and how ?

When a program is started, it finishes executing automatically after sometime. Server is a program, once it is started it keeps running unless it is stopped. It keeps running and does not need to be restrted, even when computer is shut down and restarted. How does it keep running and never ends ?

This is very confusing to me, eventhough it sounds very basic. Please explain in detail.
 
Joe Ess
Bartender
Posts: 9256
9
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jignesh soni wrote:
how is the instance of a server created ? I mean when I want create an object, it requires a program to instanciate an object. I dont see any program in here. Which program instanciates the server instance and how ?

Tomcat is a program, just like Firefox or a text editor. However, it's purpose is to bind to a port and serve JSP's and other files.
If you look in the startup batch files, you'll see that all they do is invoke the java command on a class (in 5.5 the class is org.apache.catalina.startup.Bootstrap). You can check the running processes with ps or task manager and you'll see that a new java task is running alongside all the other processes. No magic necessary.

jignesh soni wrote:
When a program is started, it finishes executing automatically after sometime. Server is a program, once it is started it keeps running unless it is stopped. It keeps running and does not need to be restrted, even when computer is shut down and restarted. How does it keep running and never ends ?


I think you are striving for a distinction where there is none. A program is code executed by a computer. Some programs can be configured to start up when the computer is started (called "services" in the Windows world, "daemons" in the Unix world). Nothing runs when the computer is off. Again, no magic necessary.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic