| Author |
ActionForm is serialized
|
wrushasen dakhane
Ranch Hand
Joined: Sep 25, 2006
Posts: 47
|
|
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
|
SCJP 1.4, SCWCD 1.4
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
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.
|
Merrill
Consultant, Sima Solutions
|
 |
wrushasen dakhane
Ranch Hand
Joined: Sep 25, 2006
Posts: 47
|
|
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
Joined: Feb 15, 2005
Posts: 4864
|
|
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.
|
 |
 |
|
|
subject: ActionForm is serialized
|
|
|