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 [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.