Re: cvs commit: jakarta-struts/src/share/org/apache/struts/util MessageResourcesFactory.java
"Deadman, Hal" wrote: > Thanks, this will make Weblogic users very happy. I am curious why the Class > variable had to be made transient since it implements Serializable. It would > be nice to know for future reference. Does it have to do with it storing a > reference to a Class loaded by a different class loader? > That was definitely the motivation. Consider that many servlet containers support automatic reloading of a webapp when you change a class. Normally, this is done by throwing away the class loader that loaded this class, and reloading everything with a new one. In that manner, any changes to the classes will be picked up. Now, what would happen if this variable had been left non-transient? The *old* version of the class would be saved and restored, and any change you made to it would not be visible! That's not what you want in this scenario. Proper serialization behavior isn't just a matter of declaring things Serializable. You also have to ensure that serializing and then deserializing your object tree does not violate other assumptions you have made -- this is why, for example, I cannot simply make the pseudo-database in the example app Serializable -- when it's reloaded, the assumption that there is only one root of the tree would now be violated. > > Thanks, Hal > Craig > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 24, 2001 12:26 PM > To: [EMAIL PROTECTED] > Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/util > MessageResourcesFactory.java > > craigmcc01/01/24 09:25:37 > > Modified:src/share/org/apache/struts/util > MessageResourcesFactory.java > Log: > Make MessageResourcesFactory (and therefore subclasses of it) > Serializable. > > Revision ChangesPath > 1.3 +9 -6 > jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java > > Index: MessageResourcesFactory.java > === > RCS file: > /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFa > ctory.java,v > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -r1.2 -r1.3 > --- MessageResourcesFactory.java 2001/01/16 03:52:57 1.2 > +++ MessageResourcesFactory.java 2001/01/24 17:25:36 1.3 > @@ -1,7 +1,7 @@ >/* > - * $Header: > /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFa > ctory.java,v 1.2 2001/01/16 03:52:57 craigmcc Exp $ > - * $Revision: 1.2 $ > - * $Date: 2001/01/16 03:52:57 $ > + * $Header: > /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFa > ctory.java,v 1.3 2001/01/24 17:25:36 craigmcc Exp $ > + * $Revision: 1.3 $ > + * $Date: 2001/01/24 17:25:36 $ > * > * > * > @@ -63,6 +63,9 @@ >package org.apache.struts.util; > > +import java.io.Serializable; > + > + >/** > * Factory for MessageResources instances. The general > usage > * pattern for this class is: > @@ -78,10 +81,10 @@ > * > * > * @author Craig R. McClanahan > - * @version $Revision: 1.2 $ $Date: 2001/01/16 03:52:57 $ > + * @version $Revision: 1.3 $ $Date: 2001/01/24 17:25:36 $ > */ > > -public abstract class MessageResourcesFactory { > +public abstract class MessageResourcesFactory implements Serializable { > >// Instance > Properties > @@ -121,7 +124,7 @@ > * The Java class to be used for > * MessageResourcesFactory instances. > */ > -protected static Class clazz = null; > +protected static transient Class clazz = null; > >/**
RE: cvs commit: jakarta-struts/src/share/org/apache/struts/util MessageResourcesFactory.java
Thanks, this will make Weblogic users very happy. I am curious why the Class variable had to be made transient since it implements Serializable. It would be nice to know for future reference. Does it have to do with it storing a reference to a Class loaded by a different class loader? Thanks, Hal -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 24, 2001 12:26 PM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/util MessageResourcesFactory.java craigmcc01/01/24 09:25:37 Modified:src/share/org/apache/struts/util MessageResourcesFactory.java Log: Make MessageResourcesFactory (and therefore subclasses of it) Serializable. Revision ChangesPath 1.3 +9 -6 jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java Index: MessageResourcesFactory.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFa ctory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MessageResourcesFactory.java 2001/01/16 03:52:57 1.2 +++ MessageResourcesFactory.java 2001/01/24 17:25:36 1.3 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFa ctory.java,v 1.2 2001/01/16 03:52:57 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2001/01/16 03:52:57 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFa ctory.java,v 1.3 2001/01/24 17:25:36 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/01/24 17:25:36 $ * * * @@ -63,6 +63,9 @@ package org.apache.struts.util; +import java.io.Serializable; + + /** * Factory for MessageResources instances. The general usage * pattern for this class is: @@ -78,10 +81,10 @@ * * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2001/01/16 03:52:57 $ + * @version $Revision: 1.3 $ $Date: 2001/01/24 17:25:36 $ */ -public abstract class MessageResourcesFactory { +public abstract class MessageResourcesFactory implements Serializable { // Instance Properties @@ -121,7 +124,7 @@ * The Java class to be used for * MessageResourcesFactory instances. */ -protected static Class clazz = null; +protected static transient Class clazz = null; /**
cvs commit: jakarta-struts/src/share/org/apache/struts/util MessageResourcesFactory.java
craigmcc01/01/24 09:25:37 Modified:src/share/org/apache/struts/util MessageResourcesFactory.java Log: Make MessageResourcesFactory (and therefore subclasses of it) Serializable. Revision ChangesPath 1.3 +9 -6 jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java Index: MessageResourcesFactory.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MessageResourcesFactory.java 2001/01/16 03:52:57 1.2 +++ MessageResourcesFactory.java 2001/01/24 17:25:36 1.3 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java,v 1.2 2001/01/16 03:52:57 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2001/01/16 03:52:57 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/MessageResourcesFactory.java,v 1.3 2001/01/24 17:25:36 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/01/24 17:25:36 $ * * * @@ -63,6 +63,9 @@ package org.apache.struts.util; +import java.io.Serializable; + + /** * Factory for MessageResources instances. The general usage * pattern for this class is: @@ -78,10 +81,10 @@ * * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2001/01/16 03:52:57 $ + * @version $Revision: 1.3 $ $Date: 2001/01/24 17:25:36 $ */ -public abstract class MessageResourcesFactory { +public abstract class MessageResourcesFactory implements Serializable { // Instance Properties @@ -121,7 +124,7 @@ * The Java class to be used for * MessageResourcesFactory instances. */ -protected static Class clazz = null; +protected static transient Class clazz = null; /**