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 2010/08/26 09:11:47 UTC

svn commit: r989479 - /camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java

Author: ningjiang
Date: Thu Aug 26 07:11:46 2010
New Revision: 989479

URL: http://svn.apache.org/viewvc?rev=989479&view=rev
Log:
Added synchronized to the getAsyncProcessor method to make it thread safe

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

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java?rev=989479&r1=989478&r2=989479&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java Thu Aug 26 07:11:46 2010
@@ -35,7 +35,7 @@ public class DefaultConsumer extends Ser
     protected final transient Log log = LogFactory.getLog(getClass());
     private final Endpoint endpoint;
     private final Processor processor;
-    private AsyncProcessor asyncProcessor;
+    private volatile AsyncProcessor asyncProcessor;
     private ExceptionHandler exceptionHandler;
 
     public DefaultConsumer(Endpoint endpoint, Processor processor) {
@@ -61,8 +61,8 @@ public class DefaultConsumer extends Ser
      * processor on the consumer. If the processor does not implement the interface,
      * it will be adapted so that it does.
      */
-    public AsyncProcessor getAsyncProcessor() {
-        if (asyncProcessor == null) {
+    public synchronized AsyncProcessor getAsyncProcessor() {
+        if (asyncProcessor == null) {            
             asyncProcessor = AsyncProcessorTypeConverter.convert(processor);
         }
         return asyncProcessor;