Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ActionForm is serialized

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

ActionForm is serialized. I want to know what is the perpose of making ActionForm serialized because normally we do not persist the ActionForm data.

Wrushasen
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The J2EE spcification states that any object that is placed in session scope (or in other words may be set as an attribute of the HTTPSession object) must implement serializable. Since one of the possible scopes for an ActionForm is session, this mandate applies to an ActionForm.

The reason for this is that application servers have the option of persisting session data to disk, particularly if they need to do so to allow for more concurrent sessions. They may swap the session in and out of memory as needed.
 
wrushasen dakhane
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

"The reason for this is that application servers have the option of persisting session data to disk, particularly if they need to do so to allow for more concurrent sessions. They may swap the session in and out of memory as needed."

I didn't understand your above statement.

wrushu
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps the best way to explain it is with an example. Suppose there are currently 2000 concurrent users on your app server, all of whom have session objects in memory. The app server realizes that there isn't going to be enough memory if any more sessions are added. It might then take the 10 sessions that have been inactive for the longest time, serialize the objects, write them to disk in a temporary file, and remove them from memory. If the user for one of those sessions submits a new request, the app server recognizes that this is one of the serialized sessions, de-serializes it, and places it back in memory where it can be accessed.

If the session has a reference to an object that is not serializable, the app server obviously won't be able to serialize the session and will throw an exception when it tries to do so.
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic