Author: davsclaus
Date: Tue Oct 26 06:41:25 2010
New Revision: 1027380
URL: http://svn.apache.org/viewvc?rev=1027380&view=rev
Log:
CAMEL-3277: Fixed threading issue with OSGi causing to load type converters
concurrently and causing Camel apps to fail thereafter. Thanks to Lars for the
patch.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java?rev=1027380&r1=1027379&r2=1027380&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
Tue Oct 26 06:41:25 2010
@@ -21,7 +21,19 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.camel.CamelContext;
@@ -266,7 +278,9 @@ public class Activator implements Bundle
super(bundle, TypeConverter.class);
}
- public void load(TypeConverterRegistry registry) throws Exception {
+ public synchronized void load(TypeConverterRegistry registry) throws
Exception {
+ // must be synchronized to ensure we don't load type converters
concurrently
+ // which cause Camel apps to fails in OSGi thereafter
loader.load(registry);
}