Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Distributed Web Applications

 
Hasnain Javed Khan
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I seem to be having lots of problems in solving questions regarding distributed web applications and servlet context, servlet config etc.

Following is quoted from HFSJ


There is one ServletContext per VM.
There is one ServletConfig per servlet, per VM.


As far as I understood, if there are two JVMs, there will be two servlet contexts, two servlet configs and two instances of the same servlet per VM in total ? Am I misunderstanding the concept or missing some information ?

On page 257 of HFSJ (the two diagrams)

Note: everything is duplicated in the second server EXCEPT the HttpSession objects! Sessions live in only ONE place at any given moment. The same session ID for a given web app will NEVER appear in two VMs at the same time.


The above quote is confusing me. The same Servlet Context on VM 1 will be shifted to VM 2 or there already is a Servlet Context in VM 2 ?

Hope my question is clear.

Kind Regards.
Hasnain Javed.
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hasnain Javed Khan wrote:As far as I understood, if there are two JVMs, there will be two servlet contexts, two servlet configs and two instances of the same servlet per VM in total ? Am I misunderstanding the concept or missing some information ?

If there are 2 JVMs, then there will be two ServletContext objects and two ServletConfig objects in total (not per VM, there will be 1 ServletConfig per VM).

Hasnain Javed Khan wrote:
Note: everything is duplicated in the second server EXCEPT the HttpSession objects! Sessions live in only ONE place at any given moment. The same session ID for a given web app will NEVER appear in two VMs at the same time.

The above quote is confusing me. The same Servlet Context on VM 1 will be shifted to VM 2 or there already is a Servlet Context in VM 2 ?

The book is talking about HttpSession object not ServletContext...
 
Hasnain Javed Khan
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ankit.

Ankit Garg wrote: The book is talking about HttpSession object not ServletContext...


Yes I know the book is talking about HttpSession.What I'm talking about is the ServletContext.


The above quote is confusing me. The same Servlet Context on VM 1 will be shifted to VM 2 or there already is a Servlet Context in VM 2 ?


In the beginning of the sentence


Note: everything is duplicated in the second server


If there are two ServletContext instances in two VMs, what gets duplicated regarding the ServletContext,ServletConfig etc?

Kind Regards.
Hasnain Javed.

 
Patil Niteen
Ranch Hand
Posts: 48
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hasnain Javed Khan,
It states that all the implicit objects will be duplicated(new object will be created) except the HttpSession object on the server2. The HttpSession object will be migrated from server1 to server2(session attributes should be serialized in this case for proper migration).

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic