You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/09/15 14:28:25 UTC

svn commit: r997309 - /camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java

Author: davsclaus
Date: Wed Sep 15 12:28:25 2010
New Revision: 997309

URL: http://svn.apache.org/viewvc?rev=997309&view=rev
Log:
CAMEL-3123: Improved performance of PropertyEditorTypeConverter.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java?rev=997309&r1=997308&r2=997309&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java Wed Sep 15 12:28:25 2010
@@ -74,10 +74,8 @@ public class PropertyEditorTypeConverter
     }
 
     private <T> PropertyEditor lookupEditor(Class<T> type, Object value) {
-        Class key = value.getClass();
-
         // check misses first
-        if (misses.containsKey(key)) {
+        if (misses.containsKey(type)) {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("No previously found property editor for type: " + type);
             }
@@ -86,23 +84,23 @@ public class PropertyEditorTypeConverter
 
         synchronized (cache) {
             // not a miss then try to lookup the editor
-            PropertyEditor editor = cache.get(key);
+            PropertyEditor editor = cache.get(type);
             if (editor == null) {
                 // findEditor is synchronized and very slow so we want to only lookup once for a given key
                 // and then we use our own local cache for faster lookup
-                editor = PropertyEditorManager.findEditor(key);
+                editor = PropertyEditorManager.findEditor(type);
 
                 // either we found an editor, or if not then register it as a miss
                 if (editor != null) {
                     if (LOG.isTraceEnabled()) {
                         LOG.trace("Found property editor for type: " + type + " -> " + editor);
                     }
-                    cache.put(key, editor);
+                    cache.put(type, editor);
                 } else {
                     if (LOG.isTraceEnabled()) {
                         LOG.trace("Cannot find property editor for type: " + type);
                     }
-                    misses.put(key, key);
+                    misses.put(type, type);
                 }
             }
             return editor;