web application and process in web container in java

263 views Asked by At

Does every web application in web container will run in an isolated memory space? Is it a stand alone PROCESS?

Does every servlet run in an isolated memory space or a process?

What's the diff between java process and os process, Does every java process will run in an OS process?

1

There are 1 answers

0
Saeed Alizadeh On BEST ANSWER
  • Application data are isolated from the other applications in same web container like Tomcat or application server like jboss or Webloogic. But you should be aware that java Servlets are Classes that serve web based requests and nothing more!
  • as you know Classes are templates for creation objects or in technical speech for instantiation of objects, so usually web containers at the start up state or application deployement state create some objects from Servlet classes ready to use for serving requests (Servlet pool)
  • the next thing that would be fine to mention here is that if you declare a variable in Class scope you are using this variable in none thread-safe manner, it means that it is shared by other instances. if you do some practice on this kind of variables(class scoped variables) you can see results and odd value changes!