My understanding is that implementing read/writeObject is only necessary when 
the default Serialization won't work properly.  I believe I've only implemented 
it where it was required and when I do I typically try to use the serialization 
proxy pattern (Effective Java Item 78).

Ralph

On Oct 6, 2012, at 11:33 AM, Gary Gregory wrote:

> Hm... since Message extends Serializable, all messages could implement a 
> readObject which would undo making ivars final for the classes that currently 
> do not implement readObject. Should all Message impls implement 
> read/writeObject? Now, some do and some don't.
> 
> Gary
> 
> On Sat, Oct 6, 2012 at 1:47 PM, Ralph Goers <[email protected]> 
> wrote:
> Yes, where appropriate.
> 
> Ralph
> 
> On Oct 6, 2012, at 10:23 AM, Gary Gregory wrote:
> 
>> Can we then make more ivars final?
>> 
>> Gary
>> 
>> On Sat, Oct 6, 2012 at 2:39 AM, Ralph Goers <[email protected]> 
>> wrote:
>> So I took a look at these.  ObjectMessage and SimpleMessage already are 
>> immutable.  I've modified ParameterizedMessage, StringFormattedMessage and 
>> ThreadDumpMessage so that they are also immutable and not seen any side 
>> effects.  I've made LocalizedMessage mostly immutable but it is updated when 
>> the LCan ogEvent is created as it needs the Logger name to locate the 
>> resource bundle (this is one of the things I really dislike about the class 
>> but it is required to allow compatibility with Log4j 1.x).  MapMessage isn't 
>> immutable as the Map can be updated by calling the put method. After 
>> thinking about it I'm more inclined to leave that class as is as the default 
>> constructor creates an empty Map to be populated. 
>> 
>> Ralph
>> 
>> On Oct 5, 2012, at 2:03 PM, Gary Gregory wrote:
>> 
>>> Ok, cool. I'd like to assume this piece is settled so we can move the other 
>>> chat forward :)
>>> 
>>> Gary
>>> 
>>> On Fri, Oct 5, 2012 at 4:37 PM, Ralph Goers <[email protected]> 
>>> wrote:
>>> Yes, they should all be. Even MapMessage really shouldn't allow the Map to 
>>> be updated through the Message.  I'll have to look at them and figure out 
>>> why I let some of them have set methods.
>>> 
>>> Ralph
>>> 
>>> 
>>> On Oct 5, 2012, at 1:25 PM, Gary Gregory wrote:
>>> 
>>>> Hi All:
>>>> 
>>>> Should Message implementations be immutable?
>>>> 
>>>> At least:
>>>> ObjectMessage
>>>> ParameterizedMessage
>>>> SimpleMessage
>>>> StringFormattedMessage
>>>> ThreadDumpMessage
>>>> 
>>>> Gary
>>>> 
>>>> -- 
>>>> E-Mail: [email protected] | [email protected] 
>>>> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
>>>> Spring Batch in Action: http://bit.ly/bqpbCK
>>>> Blog: http://garygregory.wordpress.com 
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> E-Mail: [email protected] | [email protected] 
>>> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
>>> Spring Batch in Action: http://bit.ly/bqpbCK
>>> Blog: http://garygregory.wordpress.com 
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>> 
>> 
>> 
>> 
>> -- 
>> E-Mail: [email protected] | [email protected] 
>> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
>> Spring Batch in Action: http://bit.ly/bqpbCK
>> Blog: http://garygregory.wordpress.com 
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
> 
> 
> 
> 
> -- 
> E-Mail: [email protected] | [email protected] 
> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
> Spring Batch in Action: http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Reply via email to