• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Distributed Web Applications

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 48
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic