You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@excalibur.apache.org by Marcus Crafter <cr...@managesoft.com> on 2004/11/23 21:51:56 UTC
Transient m_logger in AbstractLogEnabled?
Hi Guys,
Hope all is going well.
Torsten and I were playing around some XStream serialization of
components this evening.
Everything worked out really well, however part of the component's state
that was written out to the resultant file was the 'm_logger' member
variable in AbstractLogEnabled.
Since this was the full logger object, the resultant XML file for one
object was around 350kb, rather than 3k :)
Since persistence of any component will require the logger to be re-set
on the component when it's recovered we thought it would make sense to
set the m_logger field to 'transient' in AbstractLogEnabled?
The change would be:
private Logger m_logger;
becomes:
private transient Logger m_logger;
Since this is a change to framework though, and one in the area of
serialization where we don't know all the details, we thought we'd bring
it up on the list - what does everyone think?
Cheers,
Marcus
--
.....
,,$$$$$$$$$, Marcus Crafter
;$' '$$$$: Computer Systems Engineer
$: $$$$: ManageSoft Corporation
$ o_)$$$: Frankfurt am Main, Germany
;$, _/\ &&:'
' /( &&&
\_&&&&'
&&&&.
&&&&&&&:
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/
Re: Transient m_logger in AbstractLogEnabled?
Posted by Peter Donald <pe...@realityforge.org>.
Marcus Crafter wrote:
> Since persistence of any component will require the logger to be re-set
> on the component when it's recovered we thought it would make sense to
> set the m_logger field to 'transient' in AbstractLogEnabled?
>
> The change would be:
>
> private Logger m_logger;
>
> becomes:
>
> private transient Logger m_logger;
>
> Since this is a change to framework though, and one in the area of
> serialization where we don't know all the details, we thought we'd bring
> it up on the list - what does everyone think?
+1
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/
Re: Transient m_logger in AbstractLogEnabled?
Posted by Niclas Hedhman <ni...@hedhman.org>.
On Wednesday 24 November 2004 16:46, Leo Simons wrote:
> > Generally speaking; To obtain long term compatibility of serialization,
> > it is wise to implement the readObject() and writeObject() methods plus
> > setting the serialVersionUID variable.
>
> serialVersionUID and its associated tool suck ass as an idea,
With RMI/Serialization hat on;
If you have no strong need to keep the serialVersionUID compatible with an
existing, released version of the class, you can simply put in;
static long serialVersionUID = 1L;
into the classes, and only change IF (and that should be avoided)
serialization compatibility can not be maintained.
I.e serialtool is not needed if you start out from scratch.
Hat-off.
Cheers
Niclas
--
+------//-------------------+
/ http://www.dpml.net /
/ http://niclas.hedhman.org /
+------//-------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/
Re: Transient m_logger in AbstractLogEnabled?
Posted by Marcus Crafter <cr...@managesoft.com>.
Hi All,
Leo Simons wrote:
>>On Wednesday 24 November 2004 04:51, Marcus Crafter wrote:
>>
>>
>>>Since persistence of any component will require the logger to be re-set
>>>on the component when it's recovered we thought it would make sense to
>>>set the m_logger field to 'transient' in AbstractLogEnabled?
>>>
>>>The change would be:
>>>
>>> private Logger m_logger;
>>>
>>>becomes:
>>>
>>> private transient Logger m_logger;
>
>
> +1. I doubt anyone depends on non-transient loggers! Do remember to put
> in a testcase for something like that :-D
Ok, will do.
> PS: I'm "old school" in the sense that I think serialization of
> components/services as in "things that *do* stuff" is not that good an
> idea, and instead you should be serializing data objects (ie the
> configuration objects).
Sure - we should probably refactor our work a bit to get a pure data
object, currently the object is a data object with a few operations that
extends from AbstractLogEnabled for logging purposes.
Cheers,
Marcus
--
.....
,,$$$$$$$$$, Marcus Crafter
;$' '$$$$: Computer Systems Engineer
$: $$$$: ManageSoft Corporation
$ o_)$$$: Frankfurt am Main, Germany
;$, _/\ &&:'
' /( &&&
\_&&&&'
&&&&.
&&&&&&&:
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/
Re: Transient m_logger in AbstractLogEnabled?
Posted by Leo Simons <ls...@jicarilla.org>.
Niclas Hedhman wrote:
> On Wednesday 24 November 2004 04:51, Marcus Crafter wrote:
>
>>Since persistence of any component will require the logger to be re-set
>>on the component when it's recovered we thought it would make sense to
>>set the m_logger field to 'transient' in AbstractLogEnabled?
>>
>>The change would be:
>>
>> private Logger m_logger;
>>
>>becomes:
>>
>> private transient Logger m_logger;
+1. I doubt anyone depends on non-transient loggers! Do remember to put
in a testcase for something like that :-D
> Generally speaking; To obtain long term compatibility of serialization, it is
> wise to implement the readObject() and writeObject() methods plus setting the
> serialVersionUID variable.
serialVersionUID and its associated tool suck ass as an idea, but its
the only thing which always works :/. However, IIRC XStream doesn't work
as well if you use these. Kinda defeats its purpose.
> If that is done, transient has no effect.
> Testing of such compatibility also requires that serialized instances are
> saved and checked in to the code repository. :o)
>
> If the AF is going to be properly serializable, I suggest that it is done
> properly across all classes, incl. of the tests.
+0 (agree but not going to do the work...)
- LSD
PS: I'm "old school" in the sense that I think serialization of
components/services as in "things that *do* stuff" is not that good an
idea, and instead you should be serializing data objects (ie the
configuration objects).
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/
Re: Transient m_logger in AbstractLogEnabled?
Posted by Niclas Hedhman <ni...@hedhman.org>.
On Wednesday 24 November 2004 04:51, Marcus Crafter wrote:
> Since persistence of any component will require the logger to be re-set
> on the component when it's recovered we thought it would make sense to
> set the m_logger field to 'transient' in AbstractLogEnabled?
>
> The change would be:
>
> private Logger m_logger;
>
> becomes:
>
> private transient Logger m_logger;
Generally speaking; To obtain long term compatibility of serialization, it is
wise to implement the readObject() and writeObject() methods plus setting the
serialVersionUID variable. If that is done, transient has no effect.
Testing of such compatibility also requires that serialized instances are
saved and checked in to the code repository. :o)
If the AF is going to be properly serializable, I suggest that it is done
properly across all classes, incl. of the tests.
Cheers
Niclas
--
+------//-------------------+
/ http://www.dpml.net /
/ http://niclas.hedhman.org /
+------//-------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/