You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2012/10/01 17:44:08 UTC

org.apache.logging.log4j.message.MapMessage impl refinement

Hi All:

In org.apache.logging.log4j.message.MapMessage, the map is typed as
Map<String, String> but every time we want to do something with it, it is
converted to a TreeMap (impls. SortedMap).

- This is wasteful if the map is already a SortedMap.
- There is a lot code duplication to create the sorted maps.

How about adding a SortedMap ctor and converting the passed in map to a
TreeMap for other ctors?

Gary

-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: org.apache.logging.log4j.message.MapMessage impl refinement

Posted by Gary Gregory <ga...@gmail.com>.
Done: Committed revision 1392429.

No new ctor after all.

Gary

On Mon, Oct 1, 2012 at 12:13 PM, Ralph Goers <ra...@dslextreme.com>wrote:

> Go for it!
>
> Ralph
>
> On Oct 1, 2012, at 8:44 AM, Gary Gregory wrote:
>
> Hi All:
>
> In org.apache.logging.log4j.message.MapMessage, the map is typed as
> Map<String, String> but every time we want to do something with it, it is
> converted to a TreeMap (impls. SortedMap).
>
> - This is wasteful if the map is already a SortedMap.
> - There is a lot code duplication to create the sorted maps.
>
> How about adding a SortedMap ctor and converting the passed in map to a
> TreeMap for other ctors?
>
> Gary
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> JUnit in Action, 2nd Ed: <http://goog_1249600977/>http://bit.ly/ECvg0
> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: org.apache.logging.log4j.message.MapMessage impl refinement

Posted by Ralph Goers <ra...@dslextreme.com>.
Go for it!

Ralph

On Oct 1, 2012, at 8:44 AM, Gary Gregory wrote:

> Hi All:
> 
> In org.apache.logging.log4j.message.MapMessage, the map is typed as Map<String, String> but every time we want to do something with it, it is converted to a TreeMap (impls. SortedMap).
> 
> - This is wasteful if the map is already a SortedMap.
> - There is a lot code duplication to create the sorted maps.
> 
> How about adding a SortedMap ctor and converting the passed in map to a TreeMap for other ctors?
> 
> Gary
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> 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