• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

j2ee certificate ques

 
singh santosh
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,

i have few doubts over this
option 2:how can we rely on ServletConfig ,they can be configured to have diff value?

option4)can we share HttpSession ,doesnt sharing different from session migration?

guys help me out ?

thanks & regards
-santosh
 
Sandeep Singh Kunwar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi santosh!
option 2:how can we rely on ServletConfig ,they can be configured to have diff value?

I also want some clarification.

option4)can we share HttpSession ,doesnt sharing different from session migration?

what i understand is that sharing is different from session migration.
And while session migration a object can be in only and only one session at a time.

More clarifications are needed.
 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I am very unsure of the answers. Can someone point out the right answer to this question.

Regards,
Shivani.
 
Mohd Fuzail
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.You cannot rely on the ServletContext to share data.
Since we have Servlet Context per app per VM

2. You cannot rely on ServletConfig for distributed web-applications.
Since we have Servlet Config per Servlet

3. Each JVM has a separate instance of a servlet context.
I think this should be also a part of answers!!! Unless we have one app distributed accross multiple VM, in which case option 1 should not be a part of answer !!! Comments please

4. HttpSessions can be shared across distributable web-applications.
When HttpSessions is required in Distributed Application, it is migrated to the VM where it's required. So sharing is possible
 
akshay pandit
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Fuzail,

4. HttpSessions can be shared across distributable web-applications.
When HttpSessions is required in Distributed Application, it is migrated to the VM where it's required. So sharing is possible


In my opinion sharing of session is not possible.. it can be migrated.. but not shared, by sharing what I understood was that after the session is migrated from one VM (VM1)to another(VM2), still VM1 can use the session, which I think is not possible. Once the session is migrated to VM2, VM1 will no longer be able to access the session..

Guru's please comment .....


Thanks..
Akshay
 
Amit Tayal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I have a different interpretation for first two options:

1.You cannot rely on the ServletContext to share data.
True, As each we have one ServletContext per VM and if we add any new attribute added to one ServletContext, it cannot be moved to other Servlet context automatically.

2. You cannot rely on ServletConfig for distributed web-applications.
False, Even though we do have one ServletConfig per VM, we can not add or modify any variable in it, so it can be considered as safe. (Here I made one assumption that same application has been deployed at all the servers)

Please let me know is it fine or not.

Amit
 
Mohd Fuzail
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Possible scenrio of Session sharing in Distributed Environment

Lets say we have 2 VM, VM1 and VM2. Request comes for a servlet1 on VM1, so its handled there, and the reponse is send back. In the mean time due to load sharing/distribution Servlet1 is moved to VM2, now same client make a reply or send some more information in the same session to Servlet1, the Container will see that now the servlet has been moved to VM2, so the HttpSession will be migrated from VM1 to VM2, to continue to send the request to Servlet1. At one time one HttpSession can be present at one place only and from client perspective it might see a little delay and laod balancing is totally transparent

You cannot rely on ServletConfig for distributed web-applications.
We have one servlet config per Servlet not per VM
 
Amit Tayal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Fuzail
I have a query related to Distributed web-application.

As per my understanding of distributed web-applications, each VM has it's own copy of web-application but as per above mentioned reply we are migrating the complete servlet for the sake of load balancing.

So, it means we can migrate the servlet while doing load balancing.

Amit

PS: I have a very small knowledge of Distributed web-application, so please don't get offended by my silly question.
 
Mohd Fuzail
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No questions is silly or great.. question is question..

Each VM has it's own copy of Config and Context Objects. Session object is shared accross VM by migration.

It's upto web container to do migration in case of load sharing among differrent VMs
 
Amit Tayal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As each VM has it's own copy of config so can not we say that ServletConfig is reliable in distributed environment as we can not add or modify (at runtime)anything in ServletConfig.

Amit
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic