camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1166265 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/impl/converter/ test/java/org/apache/camel/converter/
Date Wed, 07 Sep 2011 17:00:32 GMT
Author: hadrian
Date: Wed Sep  7 17:00:31 2011
New Revision: 1166265

URL: http://svn.apache.org/viewvc?rev=1166265&view=rev
Log:
CAMEL-4392. PropertyEditorTypeConverter should not be a Service

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

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java?rev=1166265&r1=1166264&r2=1166265&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
Wed Sep  7 17:00:31 2011
@@ -431,15 +431,14 @@ public abstract class BaseTypeConverterR
 
     @Override
     protected void doStart() throws Exception {
-        ServiceHelper.startService(propertyEditorTypeConverter);
+        // noop
     }
 
     @Override
     protected void doStop() throws Exception {
         typeMappings.clear();
         misses.clear();
-        // let property editor type converter stop and cleanup resources
-        ServiceHelper.stopService(propertyEditorTypeConverter);
+        propertyEditorTypeConverter.clear();
     }
 
     /**
@@ -511,5 +510,4 @@ public abstract class BaseTypeConverterR
             return fallbackTypeConverter;
         }
     }
-
 }

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=1166265&r1=1166264&r2=1166265&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  7 17:00:31 2011
@@ -22,7 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.Service;
 import org.apache.camel.TypeConverter;
 import org.apache.camel.util.LRUSoftCache;
 import org.apache.camel.util.ObjectHelper;
@@ -35,7 +34,7 @@ import org.slf4j.LoggerFactory;
  *
  * @version 
  */
-public class PropertyEditorTypeConverter implements TypeConverter, Service {
+public class PropertyEditorTypeConverter implements TypeConverter {
 
     private static final Logger LOG = LoggerFactory.getLogger(PropertyEditorTypeConverter.class);
     // use a soft bound cache to avoid using too much memory in case a lot of different classes
@@ -44,6 +43,11 @@ public class PropertyEditorTypeConverter
     // we don't anticipate so many property editors so we have unbounded map
     private final Map<Class<?>, PropertyEditor> cache = new HashMap<Class<?>,
PropertyEditor>();
 
+    public void clear() {
+        cache.clear();
+        misses.clear();
+    }
+
     public <T> T convertTo(Class<T> type, Object value) {
         // We can't convert null values since we can't figure out a property
         // editor for it.
@@ -114,15 +118,4 @@ public class PropertyEditorTypeConverter
     public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object
value) {
         return convertTo(type, value);
     }
-
-    public void start() throws Exception {
-        // noop
-    }
-
-    public void stop() throws Exception {
-        // clear caches so we dont leak
-        cache.clear();
-        misses.clear();
-    }
-
 }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/converter/PropertyEditorTypeConverterIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/converter/PropertyEditorTypeConverterIssueTest.java?rev=1166265&r1=1166264&r2=1166265&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/converter/PropertyEditorTypeConverterIssueTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/converter/PropertyEditorTypeConverterIssueTest.java
Wed Sep  7 17:00:31 2011
@@ -37,5 +37,4 @@ public class PropertyEditorTypeConverter
         }
         log.info("Time taken: " + watch.stop());
     }
-
 }



Mime
View raw message