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 LogEvent 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
