Freeman,

On Tuesday 02 September 2008 4:25:40 am [EMAIL PROTECTED] 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
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to