You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/12/21 06:27:04 UTC

svn commit: r892690 - in /camel/trunk/components/camel-protobuf: pom.xml src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java

Author: ningjiang
Date: Mon Dec 21 05:27:03 2009
New Revision: 892690

URL: http://svn.apache.org/viewvc?rev=892690&view=rev
Log:
CAMEL-2148 Applyed double-checked locking pattern and created camel-protobuf bundle

Modified:
    camel/trunk/components/camel-protobuf/pom.xml
    camel/trunk/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java

Modified: camel/trunk/components/camel-protobuf/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-protobuf/pom.xml?rev=892690&r1=892689&r2=892690&view=diff
==============================================================================
--- camel/trunk/components/camel-protobuf/pom.xml (original)
+++ camel/trunk/components/camel-protobuf/pom.xml Mon Dec 21 05:27:03 2009
@@ -10,8 +10,12 @@
 
 	<groupId>org.apache.camel</groupId>
 	<artifactId>camel-protobuf</artifactId>
-	<packaging>jar</packaging>
+	<packaging>bundle</packaging>
 	<name>camel-protobuf</name>
+	
+	<properties>
+    	<camel.osgi.export.pkg>org.apache.camel.dataformat.protobuf.*</camel.osgi.export.pkg>
+  	</properties>
 
 	<dependencies>	
 		<dependency>

Modified: camel/trunk/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java?rev=892690&r1=892689&r2=892690&view=diff
==============================================================================
--- camel/trunk/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java (original)
+++ camel/trunk/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java Mon Dec 21 05:27:03 2009
@@ -37,7 +37,7 @@
 
     private Message defaultInstance;
     private String instanceClassName;
-    private AtomicBoolean setDefaultInstanceHasBeenCalled = new AtomicBoolean(false);
+    
     
     /**
      * @param defaultInstance
@@ -98,12 +98,12 @@
      */
     public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
                
-        if (this.defaultInstance == null) {
+        if (defaultInstance == null) {
             if (instanceClassName == null) {
                 throw new CamelException("There is not defaultInstance for protobuf unmarshaling");
             } else {
                 synchronized (this) {
-                    if (!setDefaultInstanceHasBeenCalled.getAndSet(true)) {
+                    if (defaultInstance == null) {
                         defaultInstance = loadDefaultInstance(instanceClassName, exchange.getContext());
                     }
                 }