cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freeman Fang <freeman.f...@gmail.com>
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 14:04:59 GMT
Hi Dan,

You are correct, we needn't lookup operation in this case, just copy the 
entry which is serializable, I will refactor code according to your 
suggestion.

Thanks

Freeman

Daniel Kulp wrote:
> 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.
>
>   


Mime
View raw message