• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ Session Management question

 
Tyronne Fernando
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The following question from HFSJ 2nd edition page 271.

Which statements about HttpSession objects in distributed environments are true? (Choose all that apply.)

A. When a session is moved from one JVM to another, any attributes stored in the session will be lost.

B. When a session is moved from one JVM to another, appropriately registered HttpSessionBindingListener objects will be notified.

C. When a session is moved from one JVM to another, any session attribute implmenting the HttpSessionActivationListener interface will be notified.

D. When a session is moved from one JVM to another, attribute values that implement java.io.Serializable will be transferred to the new JVM.

C and D are given as correct answers. Isn't B correct as well? When a session migrates to a different JVM, isn't the attributes going to unbind from the session?

Thanks in advance.
 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tyronne Fernando:
Hi,

The following question from HFSJ 2nd edition page 271.

Which statements about HttpSession objects in distributed environments are true? (Choose all that apply.)

A. When a session is moved from one JVM to another, any attributes stored in the session will be lost.

B. When a session is moved from one JVM to another, appropriately registered HttpSessionBindingListener objects will be notified.

C. When a session is moved from one JVM to another, any session attribute implmenting the HttpSessionActivationListener interface will be notified.

D. When a session is moved from one JVM to another, attribute values that implement java.io.Serializable will be transferred to the new JVM.

C and D are given as correct answers. Isn't B correct as well? When a session migrates to a different JVM, isn't the attributes going to unbind from the session?

Thanks in advance.


session is needed to be migrated to a different JVM because that JVM need to process a request from same client which the session is attached to. So those attributes bound to the session should be shipped with the session. Isn't it? They can't be unbound from the session. This is what I fell about it...
[ December 15, 2008: Message edited by: Vijitha Kumara ]
 
Tyronne Fernando
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's how I understood after reading some of the other threads in the forum as well. Correct me if I am wrong.
 
liao Yang
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
B is not correct. HttpSessionBindingListener are only notified when an attribute is bound/unbound to the session, they are not notified when the session migration happens.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic