• 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

session behavior in distributed environment

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a question regarding session behavior in distributed environment. Say I have 2 servers in clusters. If inside the servlet, the application call session.invalidate() method right after the session is move from server A to server B, what will happen? Also, any session attribute that's not implementing java.io.Serializable will not be migrated. Does it mean I'll get null value if I call session.getAttribute("XXX") when the session is moved to server B where the attribute is set when the session is in server A? Does the behavior depend on server? (we are using JRun)

Thanks

Calvin

[ January 21, 2005: Message edited by: Calvin Kong ]
[ January 21, 2005: Message edited by: Calvin Kong ]
 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the application call session.invalidate() method right after the

The session will be invalidated and that session object is ready for GC.

Also, any session attribute that's not implementing java.io.Serializable will not be migrated

It depends upon the container implementation. If the attribute it not serialized you will get null after the migration of session. Actually some container may throw error if attribute is not serialized(but i am not very sure about it). Lets wait for the reply from other guys.

Hope that helps.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Calvin Kong:
If inside the servlet, the application call session.invalidate() method right after the session is move from server A to server B, what will happen?


Assuming you are using session replication, the session will be invalidated in both places. If you are planning to allow the session to move between servers, you should be using replication. (Otherwise you could get inconsistent results.)

Also, any session attribute that's not implementing java.io.Serializable will not be migrated. Does it mean I'll get null value if I call session.getAttribute("XXX") when the session is moved to server B where the attribute is set when the session is in server A? Does the behavior depend on server? (we are using JRun)


Yes, it depends on the server. WebSphere logs an exception and then places null in the session.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic