• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext in distributable web application

 
Anoopriya Muthuswaami
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which statements are true about distributable web applications

1) There will be one instance of ServletContext in each VM
2) There will be only one instance of the default ServletContext in only one VM(the default ServletContext is one created for all servlets not deployed as part of an application are assigned)
3) All request that are part of a session must be handled by one VM at a time
4) Container must notify any session attributes implementing the HttpSessionActivationListener interface during migration of a session from one VM to another

Answer: 1,2,3,4

I can understand options 1,3 and 4 and know they are true.
Can anyone explain option 2
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option 2 is written in poor English and with bad grammar. The author is most likely trying to trick the test taker by attempting to describe something he/she calls a "default ServletContext."

Number 2 should be false.
 
Bangar Raju
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and about option 2... how can that be true?
 
Bangar Raju
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I mean option 3.. how can it be true???
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bangar Raju:
Sorry I mean option 3.. how can it be true???


Which says,

All request that are part of a session must be handled by one VM at a time


session object may live in one JVM at a time (even if we consider an environment where the application is distributed among several JVMs),hence the statement is true.
 
vipin jain
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one explaine me why option 2 false?
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vipin jain:
Any one explaine me why option 2 false?


I cannot get anything out of it . As James explained earlier it's nothing but poor English with bad grammar.
 
vipin jain
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Vijitha,

Thanks for reply..........
 
Jayr Motta
Ranch Hand
Posts: 110
Google App Engine Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've this same doubt about the second affirmation but there is something more where i've read: (This is a question from Enthuware Test Studio)

"A separate instance of a non-default servlet context will be available on each of the JVMs."
"The default servlet context will be present only on one of the JVMs."

In the book i've read (Head First Servlets & JSP SCWCD5) there is nothing about a non-default and a default servlet context. The question with this answer also make this consider:

"Default servlet context is provided to servlets that are not deployed as a part of some webapplication. They are considered to be a part of "default" webapplication."

How can any servlet not being part of some webapplication?

--

And this other affirmation about all request of a given session to be handled by a single JVM each time, i want to understand this concept of "time". The most close i could get thinking on it is that while there is a thread associated with some session in a JVM all others will get the same JVM, until all threads "die" and it possible change at other requests. Is this correct?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic