cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: svn commit: r691148 - /cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
Date Tue, 02 Sep 2008 13:27:15 GMT

Freeman,

On Tuesday 02 September 2008 4:25:40 am ffang@apache.org wrote:
>                      //copy properties
>                      Set<String> keys = inMessage.keySet();
>                      for (String key : keys) {
> -                        msg.setProperty(key, inMessage.get(key));
> +                        if (inMessage.get(key) instanceof Serializable) {
> +                            msg.setProperty(key, inMessage.get(key));
> +                        }
>                      }

Just a quick code suggestion....

If you are interested in both the Key and the Value, it is much faster to use 
the entryset instead of the keyset and then re-lookup each value by key:


for (Map.Entry<String, Object> ent : inMessage.entrySet()) {
      if (ent.getValue() instanceof Serializable) {
           msg.setProperty(ent.getKey(), ent.getValue());
      }
}

It avoids the hashtable lookup for each value.

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message