tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Whitlock" <jwhitl...@starprecision.com>
Subject RE: Serialized Java Beans.
Date Thu, 30 Oct 2003 17:09:38 GMT
Andoni,
	You can't serialize a class if it doesn't implement the
Serializable Interface.

-----Original Message-----
From: Andoni [mailto:andoni@indigo.ie] 
Sent: Thursday, October 30, 2003 10:17 AM
To: Tomcat Users List
Subject: Re: Serialized Java Beans.

My JavaBeans are being stored in session even though they don't
explicitly
implement java.io.Serializable.

What am I missing?  Should I add it?

Andoni.


----- Original Message -----
From: "Shapira, Yoav" <Yoav.Shapira@mpi.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Wednesday, October 29, 2003 5:19 PM
Subject: RE: Serialized Java Beans.



Howdy,
It's good practice to make beans that you put in a session Serializable.
Tomcat indeed serializes sessions by default, and if you put a
non-Serializable bean in the session you'll get a runtime exception.

However, tomcat doesn't due this to free memory under load as much as it
does it to persist sessions across server restarts.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Andoni [mailto:andoni@indigo.ie]
>Sent: Wednesday, October 29, 2003 10:10 AM
>To: Tomcat Users List
>Subject: Serialized Java Beans.
>
>Hello,
>
>I recently read that if a JavaBean implements Serializable the servlet
>engine can write it to disk if it is not being used and if it's
algorithm
>decides this would be a good idea.
>
>Can anybody tell me if Tomcat does this?  Should I be sure to always
>implement Serializable in JavaBeans that I am storing in session?
>
>The actual quote from the book is:
>
>Occasionally some servers may choose to write these attributes to disk
to
>free memory.  To take advantage of this functionality, it is a good
idea to
>ensure that any objects placed inside a session implement the
>java.io.Serializable interface so that the object may be written to a
>stream. In a similar manner, applications that execute inside a
distributed
>environment may have their entire sessions and session attributes
>passivated and reactivated on a different machine.  If our application
is
>marked as distributable then it is important that any session
attributes
>are Serializable to support this.
>
>Wrox: Professional SCWCD Certification: ISBN 1-86100-770-1
>
>
>Thanks,
>
>Andoni.



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary
and/or privileged.  This e-mail is intended only for the individual(s)
to
whom it is addressed, and may not be saved, copied, printed, disclosed
or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message