Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

valueUnbound method

 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please list the scenarios of the HttpSessionBindingListener.valueUnbound method will be called.

like

1. When the session about to time out.
2.


While removing/replacing the attribute from the session , whether the unbound method will be called or not?


in the same way , when the session is about to timeout , removeAttribute() method should be called before the timeout right ??

somebody please clarify doubts.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


how far you try this ?
-----------------------------------------------
While removing the attribute from the session
------------------------------------------------
 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i didnt try till now.

I just want to make sure my understanding in concepts. :-)
 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thought of sharing you the information :

When session was created


When the Dog Object Added to the Session.


When the added Dog object has been reaplced with another Dog Object.


when the replaced Dog Object Removed from the Session


Again When the Dog Object Added to the Session.


While invalidating the session.


so while removing /replacing the attribute from the session (using setAttribute/removeAttribute) unBound method will be called.

but during sessiont timeout / invalidation , only the unbound method will be called. NOT attributeRemoved method.
[ August 11, 2008: Message edited by: deepa raj ]
 
Lakshmi Narayanan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so while removing /replacing the attribute from the session (using setAttribute/removeAttribute) unBound method will be called

When we set the attribute only valueBound is called not valueUnbound. If i am wrong please correct me.
RemoveAttribute or replacing - valueUnbound and corresponding attributeRemoved/attributeReplaced is correct.

eg.,
When we call twice setAttribute I feel only valueBound is called.
setAttribute("javaranch", new com.javaranch());
setAttribute("javaranch", new com.javaranch());
 
Lakshmi Narayanan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While invalidating the session.

code:
--------------------------------------------------------------------------------

HttpSessionBindingListener.valueUnBoundHttpSessionListener.sessionDestroyed


What is the sequence on this
first valueUnbound and then sessionDestroyed right
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic